munkeyroot
Registered User.
- Local time
- Today, 16:51
- Joined
- Jan 13, 2011
- Messages
- 76
Hi everyone
i am having a little trouble with some code for a search box.
on my main form i have a quote Field "Quote Rev Number" - the quote could be a number or numbertext.
i have an unbound text box called txt_QuoteRevSearch
then a command button with the below script:
Private Sub btn_qouterevsearch_Click()
If IsNull(txt_QuoteRevSearch) = False Then
Me.Recordset.FindFirst "[Quote Rev Number]=" & txt_QuoteRevSearch
Me!txt_QuoteRevSearch = Null
If Me.Recordset.NoMatch Then
MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
Me!txt_QuoteRevSearch = Null
End If
End If
End Sub
if i type the quote number with numbers and text:
"800500rev1": i get a syntax error: (missing operator) in expression
if i type the quote number:
"800500": i get Data type mismatch in criteria Expression. .. i think this is because i switched the datatype from number to short text
The reason i am using numbers and text is that each main form is a 1 quote for a customer - however their could be variations or addition for this one quote.
so the original Quote number would be 800500 then and new Quote would be made for a second option but with a new quote number "800500rev1" for instance.
hope this make sense
cheers munk
i am having a little trouble with some code for a search box.
on my main form i have a quote Field "Quote Rev Number" - the quote could be a number or numbertext.
i have an unbound text box called txt_QuoteRevSearch
then a command button with the below script:
Private Sub btn_qouterevsearch_Click()
If IsNull(txt_QuoteRevSearch) = False Then
Me.Recordset.FindFirst "[Quote Rev Number]=" & txt_QuoteRevSearch
Me!txt_QuoteRevSearch = Null
If Me.Recordset.NoMatch Then
MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
Me!txt_QuoteRevSearch = Null
End If
End If
End Sub
if i type the quote number with numbers and text:
"800500rev1": i get a syntax error: (missing operator) in expression
if i type the quote number:
"800500": i get Data type mismatch in criteria Expression. .. i think this is because i switched the datatype from number to short text
The reason i am using numbers and text is that each main form is a 1 quote for a customer - however their could be variations or addition for this one quote.
so the original Quote number would be 800500 then and new Quote would be made for a second option but with a new quote number "800500rev1" for instance.
hope this make sense
cheers munk