Help with sql string building

  • Thread starter Thread starter Jack
  • Start date Start date
J

Jack

Hi,
I need to convert a QBE query to sql string

The QBE in sql is as follows:

SELECT EmployeePlant.EmployeeID, EmployeePlant.EmployeeName,
EmployeePlant.Type
FROM EmployeePlant
WHERE (((EmployeePlant.Type) Like "*Quality*" Or (EmployeePlant.Type) Like
"*Q A*" Or (EmployeePlant.Type) Like "*QA*") AND
((EmployeePlant.Plant)=[Forms]![frmActionRequestFiltered]![cboPlants]));


How does one do this especially with the like clause. I appreciate any help.

I have started doing the following:
strSQL1 = "SELECT EmployeePlant.EmployeeID, EmployeePlant.EmployeeName,
EmployeePlant.Type FROM EmployeePlant " & _
"WHERE ((EmployeePlant.Type) Like '" * Quality * "'"

However I am getting type mismatch error.
Thanks
 
Assuming that Plants field is a Text data type field:

strSQL1 = "SELECT EmployeeID, EmployeeName, Type " & _
"FROM EmployeePlant WHERE (((Type) " & _
"Like ""*Quality*"" Or (Type) Like ""*Q A*""" & _
" Or (Type) Like ""*QA*"") AND " & _
"((Plant)='" & [Forms]![frmActionRequestFiltered]![cboPlants] & _
"'));"
 
Thanks Ken. I appreciate your help very much. I am going to try it now.
Regards.

Ken Snell said:
Assuming that Plants field is a Text data type field:

strSQL1 = "SELECT EmployeeID, EmployeeName, Type " & _
"FROM EmployeePlant WHERE (((Type) " & _
"Like ""*Quality*"" Or (Type) Like ""*Q A*""" & _
" Or (Type) Like ""*QA*"") AND " & _
"((Plant)='" & [Forms]![frmActionRequestFiltered]![cboPlants] & _
"'));"

--

Ken Snell
http://www.accessmvp.com/KDSnell/


Jack said:
Hi,
I need to convert a QBE query to sql string

The QBE in sql is as follows:

SELECT EmployeePlant.EmployeeID, EmployeePlant.EmployeeName,
EmployeePlant.Type
FROM EmployeePlant
WHERE (((EmployeePlant.Type) Like "*Quality*" Or (EmployeePlant.Type) Like
"*Q A*" Or (EmployeePlant.Type) Like "*QA*") AND
((EmployeePlant.Plant)=[Forms]![frmActionRequestFiltered]![cboPlants]));


How does one do this especially with the like clause. I appreciate any
help.

I have started doing the following:
strSQL1 = "SELECT EmployeePlant.EmployeeID, EmployeePlant.EmployeeName,
EmployeePlant.Type FROM EmployeePlant " & _
"WHERE ((EmployeePlant.Type) Like '" * Quality * "'"

However I am getting type mismatch error.
Thanks


.
 
Back
Top