Using .OpenAccessProject()

G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top