Re V.T.Dinh SQL reply

  • Thread starter Thread starter Mark Taimanov
  • Start date Start date
M

Mark Taimanov

Apologies for starting another thread naming you in the
message but I wasn't sure if you would go back to the
original thread "Syntax re MultiSelect List Box"

In your reply - and my thanks for it ! - you wrote :

"Why not resolve the reference to the Control when you
construct the SQL String?

Try:

Q.SQL = "SELECT * FROM [DMA Photo Library] " & _
" WHERE [subCategoryName] In (" & Criteria & _
") AND [Category] = " & Me!cboCategories

(assuming the Category Field / bound Column of the
ComboBox is numeric)."

This almost works but there is a syntax error re missing
operator(s). And the Category field of the bound column is
text.

Thank you again.

Mark
 
You need to enclose literal Text / String in double-quotes
Chr$(34). SingleQuotes OK also.

Try:

Q.SQL = "SELECT * FROM [DMA Photo Library] " & _
" WHERE [subCategoryName] In (" & Criteria & _
") AND [Category] = " & Chr$(34) & _
Me!cboCategories & Chr$(34)

HTH
Van T. Dinh
MVP (Access)

P.S. Most regular respondents watch threads they replied
to for 1 or 2 weeks at least so no problem continuing the
thread.
 
Back
Top