How to change a large complex Report query in code
Posted on 2014-02-20
The dates in this query begin as #1/1/2013# And #12/31/2013# and I need to change them with the dates in the text below.
Dim XbyAfrom as Date
Dim XbyAto as Date
Dim qdf As QueryDef
XbyAfrom = #3/1/2013#
XbyAto = #8/31/2013#
Set qdf = CurrentDb.QueryDefs("qy_DateToDateTransactionReport")
qdf.Parameters!TradeDate = "Between " & XbyAfrom & " And " & XbyAto
Reports![RpQtr-Transactions131231YTD by account].RecordSource = "qy_DateToDateTransactionReport"
DoCmd.OpenReport "RpQtr-Transactions131231YTD by account", acViewPreview, "qy_DateToDateTransactionReport", "HHID = " & ClientNowPrinting
This compiles and runs ok, but doesn't work to change the date range. Am I even close?
Some duplication here, but you get the idea. What's wrong, please?
All I need to do is replace the dates in a huge query. Not so simple using all this text in code, because of all the line breaks. I'm considering just "finding" the dates by using Right and Left instructions and replacing them by manipulating the string.