Data type mistmatch

james_IT

Registered User.
Local time
Today, 19:45
Joined
Jul 5, 2006
Messages
208
Hey guys

had a search around but cant find the answer just yet:

Got a search form that when the record is double clicked it opens a form (via a query) with that record - ready to be edited.

On the opening of the edit form i get a data type mismatch in criteria expression message box (however if i click ok it disappears and the form opens correctly.)

My code for the double click is:

Code:
Private Sub QuickSearch_DblClick(Cancel As Integer)
On Error GoTo Err_SearchList_DblClick
Dim db As DAO.Database
Dim rst As DAO.Recordset

DoCmd.OpenForm "frmEdit"

Set rst = Forms!frmEdit.Recordset.Clone

rst.FindFirst "[StockNumber] = " & Me.QuickSearch
Forms!frmEdit.Bookmark = rst.Bookmark

DoCmd.Close acForm, Me.Name

Exit_SearchList_DblClick:
    Exit Sub

Err_SearchList_DblClick:
    MsgBox Err.Description
    Resume Exit_SearchList_DblClick

End Sub

My query criteria is
Like "*" & [Forms]![frmSearch]![Search2] & "*"

Any help would be appreciated...

Thanks
 
text. does that make a difference?

the stock numbers are made up of alpha and numeric characters and symbols
 
text. does that make a difference?
Yep, sure does. You need quotes as a text delimiter (I like using Chr(34) for that) -

rst.FindFirst "[StockNumber] = " & Chr(34) & Me.QuickSearch & Chr(34)
 
Yep, sure does. You need quotes as a text delimiter (I like using Chr(34) for that) -

rst.FindFirst "[StockNumber] = " & Chr(34) & Me.QuickSearch & Chr(34)

Works like a charm - thanks Bob!
 
smile3.jpg
 

Users who are viewing this thread

Back
Top Bottom