blacksaibot
Registered User.
- Local time
- Today, 02:30
- Joined
- Jan 20, 2010
- Messages
- 31
I am looking for a good tutorial on parametrized queries in VBA.
I am creating a query based on results of another query... but one of the strings contains a single quote and destroys my second query and it cannot execute properly.
My code:
How can I turn this into a parametrized query?
Yes, I've googled it... but I don't get much out of the crap that comes up in the results.
Thanks in advance
I am creating a query based on results of another query... but one of the strings contains a single quote and destroys my second query and it cannot execute properly.
My code:
Code:
Private Sub getUserLeaderInfo(ByVal record As Long, ByVal rs As DAO.Recordset)
With rs
queryStr = "INSERT INTO t_user_ldr_info VALUES(" & _
record & ", " & _
"'" & .Fields("Controlp") & "', " & _
"'" & .Fields("Test") & "', " & _
"'" & .Fields("LoginID") & "', " & _
"'" & .Fields("DTG_Submit") & "', " & _
"'" & .Fields("PIN") & "', " & _
"'" & .Fields("SystemID") & "', " & _
"'" & .Fields("Role") & "', " & _
"'" & .Fields("Mission") & "', " & _
"'" & .Fields("Location") & "', " & _
"'" & .Fields("Other") & "', " & _
"'" & .Fields("Terrain") & "')"
End With
DoCmd.SetWarnings False
DoCmd.RunSQL (queryStr)
EndSub
How can I turn this into a parametrized query?
Yes, I've googled it... but I don't get much out of the crap that comes up in the results.
Thanks in advance