By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,656 Members | 1,893 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,656 IT Pros & Developers. It's quick & easy.

SQL and var

P: n/a

Can anyone help me with this ?
Its about the VAR "VareVar". How do I put this var in my SQL string ?
Look at this part of my SQL string(MySql):

HAVING (((T_FejlRecords.VareNr)= VareVar
Here is the full code:

Dim VareVar As String
Dim oDB As Database
Dim oQuery As QueryDef
Dim MySql As String
Set oDB = CurrentDb
Set oQuery = oDB.QueryDefs("Q_3monthBack_Prod")

VareVar = 51606106
MySql = "SELECT DISTINCTROW Format$(T_FejlRecords.DatoOpr,'mmmm
yyyy') AS [DatoOpr By Month], T_FejlRecords.VareNr, Count(*) AS [Count
Of T_FejlRecords] " & _
"FROM T_FejlRecords GROUP BY
Format$(T_FejlRecords.DatoOpr,'mmmm yyyy'), T_FejlRecords.VareNr,
Year(T_FejlRecords.DatoOpr)*12+DatePart('m',T_Fejl Records.DatoOpr)-1,
T_FejlRecords.Intern " & _
"HAVING (((T_FejlRecords.VareNr)= VareVar) AND
((T_FejlRecords.Intern)=Yes) AND

oQuery.SQL = MySql
Set oQuery = Nothing
Set oDB = Nothing
best regards Ronald

Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.