I’ve read many of the posts from gurus PHV, RoyVidar, REmou and many others but have yet to understand a few basics in passing variables in SQL.
Where is some straightforward and simple info for how to pass the var and the why of the method(s) that are required.
So, how do I get the code to work?
Why does it require that method? Simple please..
Where is some straitforward teaching?
Thanks
DBW
Do I need to:
Dim db As DAO.Database ?
Dim rs As DAO.Recordset ?
Using DAO 3.6 Object Libray
Using Windows XP, Access 2003
Code is Private Sub behind button.
Code that works is:
Code having a runtime error 3464 Data Type Mismatch in Criteria expression:
St1 is an upper limit in the WHERE portion of SQL and I will be adding another variable for the lower limit in the WHERE portion of SQL, once I get St1 to work correctly.
Where is some straightforward and simple info for how to pass the var and the why of the method(s) that are required.
So, how do I get the code to work?
Why does it require that method? Simple please..
Where is some straitforward teaching?
Thanks
DBW
Do I need to:
Dim db As DAO.Database ?
Dim rs As DAO.Recordset ?
Using DAO 3.6 Object Libray
Using Windows XP, Access 2003
Code is Private Sub behind button.
Code that works is:
Code:
Rep = ctlList.ItemData(varItem)
StrSql = "UPDATE SQ_Access_Temp SET SQ_Access_Temp.Rep = '" & Rep & "' " & _
"WHERE (((SQ_Access_Temp.ID)<=7)or (SQ_Access_Temp.ID)>=12);"
DoCmd.RunSQL StrSql
St1 is an upper limit in the WHERE portion of SQL and I will be adding another variable for the lower limit in the WHERE portion of SQL, once I get St1 to work correctly.
Code:
StrSql = "UPDATE SQ_Access_Temp SET SQ_Access_Temp.Rep = '" & Rep & "' " & _
"WHERE (((SQ_Access_Temp.ID)<=7 or (SQ_Access_Temp.ID)[b]>='" & St1 [/b] & "'));"
DoCmd.RunSQL StrSql