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

QBF building SQL 1

Status
Not open for further replies.

LHWC

Technical User
Apr 29, 2004
52
US
Hi All,
I have a form that uses combo box choices to populate the WHERE clause of an SQL string. For example:

If Not IsNull(chkAddressee) Then
strWHERE = strWHERE & " AND qryTableConsolidate.Addressee1 = " & cboAddressee
End If

When I execute this, I get Error 3075: missing operator in qryTableConsolidate.Company1 = Brendan Lee, where Brendan is the coice selected in cboaddressee. When I examine the SQL string I see :

SELECT qryTableConsolidate.* FROM qryTableConsolidate WHERE qryTableConsolidate.Addressee1=Brendan Lee

Am I missing quotes here around Brendan Lee? If so, what is the proper format for cboAddressee in the code above?

Thanks in advance.
 
strWHERE = strWHERE & " AND qryTableConsolidate.Addressee1 = [tt]'"[/tt] & cboAddresse & [tt]"'"[/tt]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV,
I tried every combination of [ ' " & but that one! Works like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top