Hi having trouble with a SQL statement

DennisP

New member
Local time
Today, 10:37
Joined
Oct 9, 2012
Messages
2
Hello,

I have been beating my head a against a wall for sometime, I'm assuming I don't have my SQL syntax correct in an Access 2010 procedure. Any insight would be greatly appreciated. thanks in advance;

CurrentProduct = Product.Text
Dim strSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim UpperGrind As Double

Set db = CurrentDb()
strSQL = "SELECT Spec.Product, Spec.[Solids-High] FROM Spec WHERE (((Spec.Product)=CurrentProduct))"
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
UpperGrind = rs![Grind-High]
Set rs = Nothing
Set db = Nothing
 
The problem is probably CurrentProduct, you need to escape it because its a variable.
 

Users who are viewing this thread

Back
Top Bottom