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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting passed data in to a SQL string 1

Status
Not open for further replies.

Binnit

Technical User
Apr 28, 2004
627
US
I have the following function in a module:-
Code:
Public Function AddRiskDetailsToHistory(TempPolicyNo As String)
I am building an INSERT sql string and need the "TempPolicyNo" parameter to be part of the string but keep getting syntax errors or no result, my sql looks like this:-

Code:
Dim strSQL As String
strSQL = "INSERT INTO tblRiskDetailsHistory 
etc etc
" FROM tblRiskDetails" & _
" WHERE (((tblRiskDetails.EXPPolicyNo)= TempPolicyNo));"

DoCmd.RunSQL (strSQL)
What is the correct syntax for the WHERE clause to reference TempPolicyNo?
Code:
" WHERE (((tblRiskDetails.EXPPolicyNo)= TempPolicyNo));"
Any help appreciated.


If IT ain’t working Binnit and Reboot
 
MP9
Thats done it...thanks a bundle, the syntax always catches me out and never sure how many " or ' or & and in which order they are required.

Are there any simple rules to follow regarding syntax use in these SQL statements?

Anyway star for you for saving me loads of time and frustration!


If IT ain’t working Binnit and Reboot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top