K
Ken Smith
The following statement is used throughout my application's coding and I have
not had a problem in the past:
Dim db As Database
Now, when I compile the application on a PC running Access 2000 or on a PC
running Access 2003, I get a compile error stating the "db As Database"
portion is a
User defined type not defined!
I have no idea what this is telling me or how to overcome it. The code for
the entire part is as follows:
Private Sub cmdOk_Click()
Dim rst As Recordset
Dim db As Database
Dim strsql As String
Dim frmName As String
frmName = Me.OpenArgs
If txtStname = "" Then
MsgBox "You must enter data into the search field", vbOKOnly, "Search
Error"
Else
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblStreet Inventory", dbOpenSnapshot)
strsql = "[Street Name] Like '*" & txtStname & "*'" & ""
rst.FindFirst strsql
If rst.NoMatch Then
MsgBox "You must enter a valid Street Name"
txtStname.SetFocus
Else
Forms!switchboard.Text1 = txtStname
End If
rst.Close
db.Close
Set rst = Nothing
Set db = Nothing
DoCmd.Close acForm, Forms!frmStreetStatusSearch1.Name, acSaveNo
DoCmd.OpenForm "StreetLookup"
End If
End Sub
not had a problem in the past:
Dim db As Database
Now, when I compile the application on a PC running Access 2000 or on a PC
running Access 2003, I get a compile error stating the "db As Database"
portion is a
User defined type not defined!
I have no idea what this is telling me or how to overcome it. The code for
the entire part is as follows:
Private Sub cmdOk_Click()
Dim rst As Recordset
Dim db As Database
Dim strsql As String
Dim frmName As String
frmName = Me.OpenArgs
If txtStname = "" Then
MsgBox "You must enter data into the search field", vbOKOnly, "Search
Error"
Else
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblStreet Inventory", dbOpenSnapshot)
strsql = "[Street Name] Like '*" & txtStname & "*'" & ""
rst.FindFirst strsql
If rst.NoMatch Then
MsgBox "You must enter a valid Street Name"
txtStname.SetFocus
Else
Forms!switchboard.Text1 = txtStname
End If
rst.Close
db.Close
Set rst = Nothing
Set db = Nothing
DoCmd.Close acForm, Forms!frmStreetStatusSearch1.Name, acSaveNo
DoCmd.OpenForm "StreetLookup"
End If
End Sub