compile error

  • Thread starter kennytwk via AccessMonster.com
  • Start date
K

kennytwk via AccessMonster.com

Hi, everytime i compile my program, this error prompt out "User-defined type
not define"

arrow pointing toward line 1(Private Sub Command2_Click()) and line 6 (Dim
cat1 As New ADOX.Catlog), i don understand the error, thanks
FYI, i have another textbox "TextDb.Name"


Private Sub Command2_Click()
On Error GoTo Err_Command2_Click

Dim str1 As String

str1 = "C:\&Me.TextDbName&.mdb"

On Error GoTo CreateAccessDBErrorTrap
Dim cat1 As New ADOX.Catlog

cat1.Create "Provide=Microsoft.Jet.OLEDB.4.0 Data Source =" & str1

CreateAccessDBExit:
Set cat1 = Nothing
Exit Sub

DoCmd.Close

CreateAccessDBErrorTrap:
If Err.Number = -2147217897 Then

Debug.Print str1
Kill (str1)
Resume
Else
Debug.Print Err.Number, Err.Description
MsgBox "Check Immediate window for error information", vbOKOnly
End If




Exit_Command2_Click:
Exit Sub

Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click

End Sub
 
A

Allen Browne

The error means you do not have a reference to the ADOX library.

From the code window, choose References on the Tools menu.
Check the box beside:
Microsoft ADO Ext 2.x for DDL and Security
 

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