Help with sql string building

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
 
K

Ken Snell

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] & _
"'));"
 
J

Jack

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


.
 

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