Compile error (1 Viewer)

Ste4en

Registered User.
Local time
Today, 10:22
Joined
Sep 19, 2001
Messages
142
When I try and run this function in the Immediate Window I get the Compile Error: User Defined type not defined. What did I miss
Thanks


Code:
Function MakeQueryDef(strSQL As String) As Boolean

Dim qdf As QueryDef

If strSQL = "" Then Exit Function

Set qdf = CurrentDb.CreateQueryDef("qryExample")
qdf.SQL = strSQL
qdf.Close
RefreshDatabaseWindow

MakeQueryDef = True

End Function
 

RuralGuy

AWF VIP
Local time
Today, 03:22
Joined
Jul 2, 2005
Messages
13,825
Do you try and compile this code first? Debug>Compile What line is causing the error? Do you have any bogus MISSING References? Tools>References
 

Ste4en

Registered User.
Local time
Today, 10:22
Joined
Sep 19, 2001
Messages
142
Thanks for answering

Debug highlights this line:
qdf As QueryDef

Tools/references shows that the following items are checked:

VB for applications
Microsoft Access 9.0 Object library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library

are any missing?

Thanks
 

RuralGuy

AWF VIP
Local time
Today, 03:22
Joined
Jul 2, 2005
Messages
13,825
I think QueryDef is DAO and you only have ADO (ActiveX) checked. Scroll down to Microsoft DAO 3.x Object Library and check the highest one and try to compile again.
 

Users who are viewing this thread

Top Bottom