J
jovii
Hi all,
I'm having a problem passing values to a parameter query. The
parameter query requires the following values:
Start date, End date (from frm!reportsmenu) and customer number (from
frm!frominvoicestoemail)
The parameter query: qryInvoices_BillsEmail is used in report:
rptInvoices_BillsEmail
The where clause in the query is :
detail.tradedate Between [forms]![reportsmenu].[startdate] And [forms]!
[reportsmenu].[enddate AND
detail.cusno = [forms]![frminvoicestoemail].[cusno]
The report is output to rtf.
I use the following code which works fine:
Set db = CurrentDb()
On Error GoTo err_deal
Set q = db.QueryDefs("qryInvoices_BillsEmail")
For Each prm In q.Parameters
prm.Value = Eval(prm.Name)
Next prm
DoCmd.OutputTo acOutputReport, "rptInvoices_BillsEmail",
acFormatRTF, "c:\petrochemicals\invoices\" & cusno & ".rtf"
My problem is the customer number can also come from another form (frm!
frominvoicestoemail), so the above code will not work. I change the
parameter query to the following:
detail.tradedate) Between [enter startdate] And [enter enddate] AND
detail.cusno = [Enter Customer Number]
And used the following code:
Set db = CurrentDb()
Set q = db.QueryDefs("qryInvoices_BillsEmail")
q.Parameters("Enter StartDate") = Forms!ReportsMenu!StartDate
q.Parameters("Enter EndDate") = Forms!ReportsMenu!EndDate
q.Parameters("Enter cusno") = Forms!frminvoicestoemail!cusno
DoCmd.OutputTo acOutputReport, "rptInvoices_BillsEmail",
acFormatRTF, "c:\petrochemicals\invoices\" & cusno & ".rtf"
When the code tries to outputthe report to rtf I have to re-enter the
start date, end date and cusno.
Is there anyway to pass the customer number from either form into the
parameter query and the export the report to rft without having to re-
enter the start date, end date and cusno?
TIA
Joe V
I'm having a problem passing values to a parameter query. The
parameter query requires the following values:
Start date, End date (from frm!reportsmenu) and customer number (from
frm!frominvoicestoemail)
The parameter query: qryInvoices_BillsEmail is used in report:
rptInvoices_BillsEmail
The where clause in the query is :
detail.tradedate Between [forms]![reportsmenu].[startdate] And [forms]!
[reportsmenu].[enddate AND
detail.cusno = [forms]![frminvoicestoemail].[cusno]
The report is output to rtf.
I use the following code which works fine:
Set db = CurrentDb()
On Error GoTo err_deal
Set q = db.QueryDefs("qryInvoices_BillsEmail")
For Each prm In q.Parameters
prm.Value = Eval(prm.Name)
Next prm
DoCmd.OutputTo acOutputReport, "rptInvoices_BillsEmail",
acFormatRTF, "c:\petrochemicals\invoices\" & cusno & ".rtf"
My problem is the customer number can also come from another form (frm!
frominvoicestoemail), so the above code will not work. I change the
parameter query to the following:
detail.tradedate) Between [enter startdate] And [enter enddate] AND
detail.cusno = [Enter Customer Number]
And used the following code:
Set db = CurrentDb()
Set q = db.QueryDefs("qryInvoices_BillsEmail")
q.Parameters("Enter StartDate") = Forms!ReportsMenu!StartDate
q.Parameters("Enter EndDate") = Forms!ReportsMenu!EndDate
q.Parameters("Enter cusno") = Forms!frminvoicestoemail!cusno
DoCmd.OutputTo acOutputReport, "rptInvoices_BillsEmail",
acFormatRTF, "c:\petrochemicals\invoices\" & cusno & ".rtf"
When the code tries to outputthe report to rtf I have to re-enter the
start date, end date and cusno.
Is there anyway to pass the customer number from either form into the
parameter query and the export the report to rft without having to re-
enter the start date, end date and cusno?
TIA
Joe V