Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error in code 1

Status
Not open for further replies.

peljo

Technical User
Mar 3, 2006
91
0
0
BG
I have a perfectly normal query giving the right results. but when i copy it and try to use it as sql i get red letters.May be i will have to change the commas or something ?

strsql = " SELECT products1.Productid, DLookUp("grade","products","productid = " & [productid]) AS Expr1, products1.items4, products1.branch4 FROM products1 WHERE (((products1.items4)>0))"
 

Perhaps this ?
Code:
strsql = "SELECT Productid, DLookUp('grade','products','productid=' & [productid]) AS Expr1, items4, branch4 FROM products1 WHERE items4>0"
Or this ?
Code:
strsql = "SELECT A.Productid, B.grade, A.items4, A.branch4 FROM products1 A INNER JOIN products B ON A.productid=B.productid WHERE A.items4>0"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top