comparing text value form to query

  • Thread starter Thread starter Rashar Sharro via AccessMonster.com
  • Start date Start date
R

Rashar Sharro via AccessMonster.com

Hi,

I have a form that when you select a customer from a combo box, a hidden
textbox called txtCust_Number on the same form is then populated with the
customers number.

On the same form, I have a navigation pane that when I click on an item
(Products), it calls this query:

Case 101
ChForm.SourceObject = "frmProducts"
ChForm.Form.RecordSource = "SELECT * FROM qryProducts"

My question is, how can I re-write the sql script to say, select all from
qryProducts where the Cust_Number from qryProducts = txtCust_Number from
the form?

Thank you.
 
Try this: There is a single and double quote just before & Me![txtCustNumber]
and a Double Quote and single quote just after.

"SELECT * from qryProducts WHERE Cust_Number = " & '" & Me![txtCustNumber]"'
 
Back
Top