PDA

Click to See Complete Forum and Search --> : SQL Select format !


Caro
Aug 2nd, 1999, 03:22 PM
Thanks for your help with the last question ScottF.
I have a new problem now - I want to populate my 'recordsource' at runtime with a select statement. I have a Customer Id in strCustID and am doing the following.
strSource = "select * from Contacts where [Customer ID] = strCustID"
Then I'm putting strSource into the recordsource of my data control
I've got something wrong here but am not sure what as my control is not pointing to the correct Cust Id, but it is correct in strCustID. Can anyone help? Thanks.

Serge
Aug 2nd, 1999, 04:43 PM
According to naming convention your variable strCustID is a string, then change you SQL statement to:

strSource = "Select * From Contacts Where[Customer ID] = '" & strCustID & "'"



If strCustID is a numeric type then change you SQL statement to:

strSource = "Select * From Contacts Where[Customer ID] = " & strCustID


Regards,

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com




[This message has been edited by Serge (edited 08-03-1999).]