R
Ross
I have some code that loops thru all the modules in the Currentdb and it
works fine. Now I want to loop thru all the modules in an external Access
database. I can seem to get the .OPenAccessProject method to work without
error. Below is the code and I have ****** Highlighted the inserted code for
external Databases
'****************************
Public Sub AllModules()
'****************************
Dim strsql As String
'Empty functions table
strsql = "DELETE tblFunctions.Module "
strsql = strsql & "FROM tblFunctions;"
DoCmd.SetWarnings False
Get_Path_Functions
Dim obj As AccessObject, dbs As Object
**************************************
ORIGINAL (CURRENT PROJECT)
Set dbs = Application.CurrentProject
INSERTED NEW CODE
Set dbs = Application.OpenAccessProject(strFileString, False)
ERROR MESSAGE SAYS:
"Compile Error: Expected function or Variable"
************************************************
' Search for open AccessObject objects in AllModules collection.
For Each obj In dbs.AllModules
strModuleName = obj.Name
If obj.Name = "modFunctions" Then
Else
List_All_Functions_Subs
End If
Next obj
DoCmd.SetWarnings True
End Sub
Why doesn't the above work?
How can I loop thru the modules in an external database?
Ross
works fine. Now I want to loop thru all the modules in an external Access
database. I can seem to get the .OPenAccessProject method to work without
error. Below is the code and I have ****** Highlighted the inserted code for
external Databases
'****************************
Public Sub AllModules()
'****************************
Dim strsql As String
'Empty functions table
strsql = "DELETE tblFunctions.Module "
strsql = strsql & "FROM tblFunctions;"
DoCmd.SetWarnings False
Get_Path_Functions
Dim obj As AccessObject, dbs As Object
**************************************
ORIGINAL (CURRENT PROJECT)
Set dbs = Application.CurrentProject
INSERTED NEW CODE
Set dbs = Application.OpenAccessProject(strFileString, False)
ERROR MESSAGE SAYS:
"Compile Error: Expected function or Variable"
************************************************
' Search for open AccessObject objects in AllModules collection.
For Each obj In dbs.AllModules
strModuleName = obj.Name
If obj.Name = "modFunctions" Then
Else
List_All_Functions_Subs
End If
Next obj
DoCmd.SetWarnings True
End Sub
Why doesn't the above work?
How can I loop thru the modules in an external database?
Ross