Select statement

  • Thread starter Thread starter Maracay
  • Start date Start date
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)
 
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)
 
Back
Top