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
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