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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing operator 1

Status
Not open for further replies.

andzejek

MIS
Sep 1, 2007
154
0
0
US
runtime error '3075':
Syntax error (missing operator) in query....

Why I'm getting this eror message when trying to open form:

DoCmd.OpenForm "customer_old", , , "where [CUST_ID] =Forms![FRM_SRCH]![lstSearch]![Value]"

where lstSearch is a listbox
 
What about this ?
DoCmd.OpenForm "customer_old", , , "CUST_ID=Forms!FRM_SRCH!lstSearch"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Some of this depends on the data type of CUST_ID. If it is numeric:
Code:
 Dim strWhere as String
 strWhere = "[CUST_ID] = " & Forms![FRM_SRCH]![lstSearch]
 DoCmd.OpenForm "customer_old", , , strWhere
If it is text
Code:
 Dim strWhere as String
 strWhere = "[CUST_ID] = """ & Forms![FRM_SRCH]![lstSearch] & """"
 DoCmd.OpenForm "customer_old", , , strWhere
If the code is running in the form "FRM_SRCH" then
Code:
 Dim strWhere as String
 strWhere = "[CUST_ID] = """ & Me![lstSearch] & """"
 DoCmd.OpenForm "customer_old", , , strWhere


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top