Microsoft
Software
Hardware
Network
Question : Trying to insert a variable into a sql statement
Hello, I'm stuck with the correct syntax for the below statement. The offending item being the use of varSeriescode in the body of the SQL statement. I'm trying to create a recordset using a field from another table. Yes, I m a beginner, though I expec tthat is obvious
If I leave it as is, I get "No value given for one or more parameters which I don't really understand
If I place single quotes around VarSeriesCode i get a type Mismatch error, which I expected and understand
Anything I try with double quotes, whether preceeded with single or & added at each end brings up a "End of Statement Error Message
What is supposed to go aroud the text?
varSeriesCode = tblrst1.Fields(8).Value
rst.Open "SELECT tblSubscriptionByCustomers
.*" & _
FROM tblSubscriptionByCustomers
WHERE (((tblSubscriptionByCustom
ers.fldSub
scriptionM
asterID)=v
arSeriesCo
de)" & _
"AND ((tblSubscriptionByCustome
rs.fldSubs
criptionTy
pe)='C'));
" _
, conn, adOpenForwardOnly, adLockReadOnly
Answer : Trying to insert a variable into a sql statement
Variables have to outside the dblquotes.
"....WHERE (((tblSubscriptionByCustom
ers.fldSub
scriptionM
asterID)="
& varSeriesCode & ")" & _
Random Solutions
Extract Birthdays between now and 30 days from today
tempdb in RAM on SQL Server 2005
System.NullReferenceExcept<wbr />ion Was Unhandled By User Code When Looping Through DataSet
event id 1073 user unable to restart
Change the background color of a CDateTimeCtrl object.
Passing Parameters to Crystal Report Viewer - ASP.Net / C#.Net
Error # 429: ActiveX component can't create object by db1 when sending automatic email
Access questions re: forms
Why the log-in time on our domain takes too long to log using my LAN port
Error exporting to PDF when report language is set to French