Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

missing operator?

Status
Not open for further replies.

Gumbo78

Programmer
Feb 17, 2004
20
US
I have a form that uses combo boxes to enter data. When there is a change in the customer name combo box, I want to search to see if the customer exists, and fill in their customer number to the appropriate area so that I dont allways have to look it up from a printed list. This is my sub

Private Sub cbcustomer_AfterUpdate()

Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone

rs.FindFirst "Customer_Name = " & [cbcustomer].Value
If rs.NoMatch = False Then
Me.Bookmark = rs.Bookmark
[cbcustid].Value = Customer.Cust_ID
End If

rs.Close
End Sub


I am getting the run time error 3077 "Syntax error (missing operator) in expression" The debugger highlights my rs.FindFirst "Customer_Name = " & [cbcustomer].Value line in yellow. I use this same syntax to perform a similar search in a different form. I'm not sure why it is not working here. Is there anything that stands out as wrong in the sub? I have been hypnotized by the same line since lunch.
 
For strings, try:

[tt]rs.FindFirst "Customer_Name = '" & [cbcustomer].Value & "'"[/tt]

- also check if there really is a value in the combo (insnull/nz...)

Roy-Vidar
 
That fixed me up. I had tried to do it as Str(Me![cbcustomer]) but was getting a mismatch error. Thanks!

-G78
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top