A
auujxa2 via AccessMonster.com
We have different networks for different divisions, and since I can't predict
the division, I'm using a select case method. I only entered 1 case. The
case is the path the current user is in.
The query runs fine. But it's updating the current database, not the "Run
Tracker" database. I need to shift the focus and define the objACC database
for the SQL code. I tried "With", that didn't work.
Please help. Thank you in advance.
Dim strSQL As String
Dim CurrentUser As String
Dim strProjectPath As String
Dim objACC As New Access.Application
strProjectPath = Application.CurrentProject.Path
CurrentUser = Environ("UserName")
DoCmd.SetWarnings False
Select Case strProjectPath
Case ("\\s914pub\Vendor Matrix - BSS")
Set objACC = GetObject("\\s914pub\Run Tracker\Run Tracker.
mdb")
strSQL = "INSERT INTO MasterTbl ( When, Who, What)" & _
" SELECT Now()" & "," & " """ & CurrentUser & ""","
& " " & "'A1'" & " AS Str"
DoCmd.RunSQL strSQL
strSQL = " UPDATE [MasterTbl] SET [Path] = Application.
CurrentProject.Path" & _
" WHERE [Path] is Null"
DoCmd.RunSQL strSQL
objACC.Quit
End Select
the division, I'm using a select case method. I only entered 1 case. The
case is the path the current user is in.
The query runs fine. But it's updating the current database, not the "Run
Tracker" database. I need to shift the focus and define the objACC database
for the SQL code. I tried "With", that didn't work.
Please help. Thank you in advance.
Dim strSQL As String
Dim CurrentUser As String
Dim strProjectPath As String
Dim objACC As New Access.Application
strProjectPath = Application.CurrentProject.Path
CurrentUser = Environ("UserName")
DoCmd.SetWarnings False
Select Case strProjectPath
Case ("\\s914pub\Vendor Matrix - BSS")
Set objACC = GetObject("\\s914pub\Run Tracker\Run Tracker.
mdb")
strSQL = "INSERT INTO MasterTbl ( When, Who, What)" & _
" SELECT Now()" & "," & " """ & CurrentUser & ""","
& " " & "'A1'" & " AS Str"
DoCmd.RunSQL strSQL
strSQL = " UPDATE [MasterTbl] SET [Path] = Application.
CurrentProject.Path" & _
" WHERE [Path] is Null"
DoCmd.RunSQL strSQL
objACC.Quit
End Select