P
Programmer - wannaB
Please someone help me with this.
I was previously directed to Look at http://www.mvps.org/access for help to
cause access to wait for another program to finnish, and to look there for
the SHELLWAIT code.
I copied the code into a stand-alone module, and everything compiled fine.
I then modified my code to use the SHELLWAIT() sub AS SO
WITH THE NEXT LINE IN THE HEADER
Dim appAccess As Access.Application
Public Sub DuplicateDB_Click()
On Error GoTo Err_DuplicateDB_Click
Const lDbFileName = "D:\Dev\AdhocReporting.ldb"
Const adhocdb = "D:\Dev\AdhocReporting.mdb"
DoCmd.Hourglass True
If Len(Dir(lDbFileName)) > 0 Then
On Error Resume Next
Kill lDbFileName
If Err.Number = 0 Then 'delete was successful, file not in use
Call RefreshData 'CALL THIS PROCEDURE TO repopulate tables
Call CompactDb 'CALL PROCEDURE TO COMPACT UPDATED DB
End If
On Error GoTo Err_DuplicateDB_Click
Else
Call RefreshData 'CALL PROCEDURE TO repopulate tables
Call CompactDb 'CALL PROCEDURE TO COMPACT UPDATED DB
End If
Set appAccess = CreateObject("Access.Application")
appAccess.Visible = True
ShellWait ("appAccess.OpenCurrentDatabase
""""D:\Dev\AdhocReporting.mdb""")
Exit_DuplicateDB_Click:
DoCmd.Hourglass False
Exit Sub
Err_DuplicateDB_Click:
MsgBox Err.Description
Resume Exit_DuplicateDB_Click
End Sub
OK SO, as I step through this is follows along just fine, however when it
SHELLs out to access it seems to be an empty access, there is no MDB file
openned. and the code continues through to the end. I can go to the DB that
this was called from and I can do that at any time during the running of the
code, i's like it shells out to a seconf instance of access but there is
nothing to prevent me from going back to the first instance while the second
remains open.
I will greatly appreciate any help, The SHELLWAIT code is far more then
anything I can understand, and you can find that at the link provided above.
THANK YOU...
I was previously directed to Look at http://www.mvps.org/access for help to
cause access to wait for another program to finnish, and to look there for
the SHELLWAIT code.
I copied the code into a stand-alone module, and everything compiled fine.
I then modified my code to use the SHELLWAIT() sub AS SO
WITH THE NEXT LINE IN THE HEADER
Dim appAccess As Access.Application
Public Sub DuplicateDB_Click()
On Error GoTo Err_DuplicateDB_Click
Const lDbFileName = "D:\Dev\AdhocReporting.ldb"
Const adhocdb = "D:\Dev\AdhocReporting.mdb"
DoCmd.Hourglass True
If Len(Dir(lDbFileName)) > 0 Then
On Error Resume Next
Kill lDbFileName
If Err.Number = 0 Then 'delete was successful, file not in use
Call RefreshData 'CALL THIS PROCEDURE TO repopulate tables
Call CompactDb 'CALL PROCEDURE TO COMPACT UPDATED DB
End If
On Error GoTo Err_DuplicateDB_Click
Else
Call RefreshData 'CALL PROCEDURE TO repopulate tables
Call CompactDb 'CALL PROCEDURE TO COMPACT UPDATED DB
End If
Set appAccess = CreateObject("Access.Application")
appAccess.Visible = True
ShellWait ("appAccess.OpenCurrentDatabase
""""D:\Dev\AdhocReporting.mdb""")
Exit_DuplicateDB_Click:
DoCmd.Hourglass False
Exit Sub
Err_DuplicateDB_Click:
MsgBox Err.Description
Resume Exit_DuplicateDB_Click
End Sub
OK SO, as I step through this is follows along just fine, however when it
SHELLs out to access it seems to be an empty access, there is no MDB file
openned. and the code continues through to the end. I can go to the DB that
this was called from and I can do that at any time during the running of the
code, i's like it shells out to a seconf instance of access but there is
nothing to prevent me from going back to the first instance while the second
remains open.
I will greatly appreciate any help, The SHELLWAIT code is far more then
anything I can understand, and you can find that at the link provided above.
THANK YOU...