Module Not Found

P

Pietro

Hi,
After converting my tables to SQL, I get this error message when i try
to access it: "Module Not Found".



Here's the only module I'm using in my database:

Function ObjectExists(strObjectType As String, strObjectName As String) As
Boolean
Dim db As Database
Dim tbl As TableDef
Dim qry As QueryDef
Dim i As Integer

Set db = CurrentDb()
ObjectExists = False

If strObjectType = "Table" Then
For Each tbl In db.TableDefs
If tbl.Name = strObjectName Then
ObjectExists = True
Exit Function
End If
Next tbl
ElseIf strObjectType = "Query" Then
For Each qry In db.QueryDefs
If qry.Name = strObjectName Then
ObjectExists = True
Exit Function
End If
Next qry
ElseIf strObjectType = "Form" Or strObjectType = "Report" Or
strObjectType = "Module" Then
For i = 0 To db.Containers(strObjectType & "s").Documents.Count - 1
If db.Containers(strObjectType & "s").Documents(i).Name =
strObjectName Then
ObjectExists = True
Exit Function
End If
Next i
ElseIf strObjectType = "Macro" Then
For i = 0 To db.Containers("Scripts").Documents.Count - 1
If db.Containers("Scripts").Documents(i).Name = strObjectName
Then
ObjectExists = True
Exit Function
End If
Next i
Else
MsgBox "Invalid Object Type passed, must be Table, Query, Form,
Report, Macro, or Module"
End If

End Function
 
S

Stefan Hoffmann

hi Pietro,
After converting my tables to SQL, I get this error message when i try
to access it: "Module Not Found".
When do you get this error?

Function ObjectExists(strObjectType As String, strObjectName As String) As
Boolean
I would use an enumeration for the object type:

Public Enum EnumObjectType
otTable, otQuery, otForm, otMacro
End Enum

Public Function ObjectExists(enuObjectType As EnumObjectType, _
strObjectName As String _
) As Boolean

Select Case enuObjectType
Case Is = otTable
'..
Case Is = otQuery
'..
Case Is = otForm
'..
Case Is = otMacro
'..
End Select

End Function





mfG
--> stefan <--
 
J

Jeff Boyce

Pietro

Tables to SQL ... check!

"when I try to access it" -- more info, please.

How are you trying to access it? Via Access? Via an Access form? Directly
via an Access linked table? In a query?

More info, please...

(p.s., check the Access front-end, open a code module, check to see if all
the References are present or one/more is MISSING)

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/
 
P

Pietro

Thank u Jeff for your reply....

"when I try to access it" means when i open the login form of the tool.

I'm sure that there are no broken refrences...
 
P

Pietro

Thank you Stefan for your reply...
I get the error when i open the loging form...
I was using the below modules normally before so i think that i don't need
to modify it.
 
S

Stefan Hoffmann

hi Pietro,
I get the error when i open the loging form...
I was using the below modules normally before so i think that i don't need
to modify it.
Take a look at the code behind to form, especially at the Form_Load()
and/or Form_Open(Cancel As Integer) events.



mfG
--> stefan <--
 

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