Const dbsLoc As String = "I:\A1136\"
Dim dbsTES As Database
Dim rstFound As Recordset
Dim OldSearchText As String

Option Compare Database
Option Explicit


Private Sub Form_Load()
Set dbsTES = OpenDatabase(dbsLoc & "97NFO.mdb")
MsgBox "loading program"
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set dbsTES = Nothing
Set rstFound = Nothing
End Sub

Private Sub cmdFind_Click()
Dim sqlStatement As String

txtSearchID.SetFocus

If txtSearchID.Text <> OldSearchText Then
Set rstFound = Nothing
OldSearchText = txtSearchID.Text
Else
Exit Sub
End If

If txtSearchID.Text = "" Then
Exit Sub
End If


sqlStatement = "SELECT * FROM tblGeneralSection WHERE tblGeneralSection.SiteID = 2"

Set rstFound = dbsTES.OpenRecordset(sqlStatement)
--snipped--
What is wrong with my code? I'm getting a type mismatch error on the last line "Set rstFound = dbsTES.OpenRecordset(sqlStatement)"

tblgeneralsection.siteid is numeric. and im running access 97.