Select statement

M

Maracay

Hi Guys,

This sql statement is not working, I think is because sales rep id is text
field, I really appreciate if someone can help me

Thanks

Set rsSR = db.OpenRecordset( _
"select SaleRepName, SaleRepID " & _
"from tblMSaleRep " & _
"where SaleRepID = " & Me.TextSalesRepID)
 
J

Jack Leach

I think is because sales rep id is text field

Correct. Enclose the text with double quotes (two sets of quotes: "")


"where SaleRepID = """ & Me.TextSalesRepID & """")


To make it a little simpler to read, you can use an aprostrophe instead:

"where SaleRepID = '" & Me.TextSalesRepID & "'")

but apostrophes will fail if the string happens to contain an apostrophe.

hth


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top