string expression in procedure

T

Tim Johnson

I copied the expression below from the SQL view of a
query.

I would like to use the statement in a procedure as a
string but I am unable to get the string format correct.


SELECT VehicleRepairsID, VIN, Make, Model, Color FROM
tblVehicleRepairs WHERE VIN Like "*" & [Forms]!
[frmSearchVIN]![txtVIN]));

VIN has Text datatype.


Thanks for any help.
 
D

Dirk Goldgar

Tim Johnson said:
I copied the expression below from the SQL view of a
query.

I would like to use the statement in a procedure as a
string but I am unable to get the string format correct.


SELECT VehicleRepairsID, VIN, Make, Model, Color FROM
tblVehicleRepairs WHERE VIN Like "*" & [Forms]!
[frmSearchVIN]![txtVIN]));

VIN has Text datatype.

You mean along the lines of

strSQL =
"SELECT VehicleRepairsID, VIN, Make, Model, Color " & _
"FROM tblVehicleRepairs " & _
"WHERE VIN Like '*" & _
[Forms]![frmSearchVIN]![txtVIN] & "';"

? That assumes that the VIN entered in txtVIN will never contain a
single-quote (') character.
 

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