string expression in procedure

  • Thread starter Thread starter Tim Johnson
  • Start date Start date
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.
 
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.
 
Back
Top