Another strange one here. My machine has UK settings for dates.
I create a parameter based on a date, I append that into a string which I then use as the string for a query. The string is correct but when the query runs it changes the date to US format. Any ideas.
Below is the code
intDwn = 6
strparam = dateadd("d",-1,date())
strSql = "SELECT dbo_tblRpt_Agreements.CustomerRef FROM ((dbo_tblRpt_Agreements " & _
"INNER JOIN dbo_tblRpt_Financials ON dbo_tblRpt_Agreements.AgreementID = " & _
"dbo_tblRpt_Financials.AgreementID) INNER JOIN dbo_tblRpt_Milestones ON " & _
"dbo_tblRpt_Agreements.AgreementID = dbo_tblRpt_Milestones.AgreementID) " & _
"INNER JOIN dbo_tblRpt_MilestoneHistory ON dbo_tblRpt_Agreements.AgreementID = " & _
"dbo_tblRpt_MilestoneHistory.AgreementID WHERE ((dbo_tblRpt_Milestones.PaymentsDown)>= " & intDwn & "
" &_
"AND ((dbo_tblRpt_MilestoneHistory.AsOfDate)= #" & strParam & "#) AND " & _
"((dbo_tblRpt_MilestoneHistory.PaymentsDown)< " & intDwn & "
);"
Set qdf = dbs.QueryDefs("qsel_col_00016_VariableDown_NG_00016"
qdf.SQL = strSql
I create a parameter based on a date, I append that into a string which I then use as the string for a query. The string is correct but when the query runs it changes the date to US format. Any ideas.
Below is the code
intDwn = 6
strparam = dateadd("d",-1,date())
strSql = "SELECT dbo_tblRpt_Agreements.CustomerRef FROM ((dbo_tblRpt_Agreements " & _
"INNER JOIN dbo_tblRpt_Financials ON dbo_tblRpt_Agreements.AgreementID = " & _
"dbo_tblRpt_Financials.AgreementID) INNER JOIN dbo_tblRpt_Milestones ON " & _
"dbo_tblRpt_Agreements.AgreementID = dbo_tblRpt_Milestones.AgreementID) " & _
"INNER JOIN dbo_tblRpt_MilestoneHistory ON dbo_tblRpt_Agreements.AgreementID = " & _
"dbo_tblRpt_MilestoneHistory.AgreementID WHERE ((dbo_tblRpt_Milestones.PaymentsDown)>= " & intDwn & "
"AND ((dbo_tblRpt_MilestoneHistory.AsOfDate)= #" & strParam & "#) AND " & _
"((dbo_tblRpt_MilestoneHistory.PaymentsDown)< " & intDwn & "
Set qdf = dbs.QueryDefs("qsel_col_00016_VariableDown_NG_00016"
qdf.SQL = strSql