Hi,
I would like to use 1 query to print a report from 2 different forms.
So normally I use the following query’s:
qry_invoice where criteria in design mode is forms!frm_invoices!invoicenr
qry_invoice2 where criteria in design mode is forms!frmdlg_reports!invoicenr
to use 1 query I tried:
dim Inr as string
Inr=forms!frm_invoices!invoicenr (or invnr=forms!frmdlg_reports!invoicenr)
docmd.openreport report!invoice,acviewpreview,, “invoicenr=“ & Inr
to sum different totals on tax I use:
One extra column(): DSum(("[amount]", "qry_invoice", "[invoice]= forms!frm_invoices!invoicenr AND [Tax] =0” )
One extra column(): DSum(("[amount]", "qry_invoice", "[invoice]=forms!frm_invoices!invoicenr AND [Tax] =-1” )
up to this stage all works petfectly, but this still requires 2 queries.
Is it possible to pass the variable “Inr“ to my query “qry_invoice“ in design mode?
to sum different totals on tax:
One extra column(): DSum(("[amount]", "qry_invoice", "[invoice]= '" & Inr & "' AND [Tax] =0” )
One extra column(): DSum(("[amount]", "qry_invoice", "[invoice]= '" & Inr & "' AND [Tax] =-1” )
this does not run, the query asks for Inr, any suggestions are appreciated
kind regards,
Louis
I would like to use 1 query to print a report from 2 different forms.
So normally I use the following query’s:
qry_invoice where criteria in design mode is forms!frm_invoices!invoicenr
qry_invoice2 where criteria in design mode is forms!frmdlg_reports!invoicenr
to use 1 query I tried:
dim Inr as string
Inr=forms!frm_invoices!invoicenr (or invnr=forms!frmdlg_reports!invoicenr)
docmd.openreport report!invoice,acviewpreview,, “invoicenr=“ & Inr
to sum different totals on tax I use:
One extra column(): DSum(("[amount]", "qry_invoice", "[invoice]= forms!frm_invoices!invoicenr AND [Tax] =0” )
One extra column(): DSum(("[amount]", "qry_invoice", "[invoice]=forms!frm_invoices!invoicenr AND [Tax] =-1” )
up to this stage all works petfectly, but this still requires 2 queries.
Is it possible to pass the variable “Inr“ to my query “qry_invoice“ in design mode?
to sum different totals on tax:
One extra column(): DSum(("[amount]", "qry_invoice", "[invoice]= '" & Inr & "' AND [Tax] =0” )
One extra column(): DSum(("[amount]", "qry_invoice", "[invoice]= '" & Inr & "' AND [Tax] =-1” )
this does not run, the query asks for Inr, any suggestions are appreciated
kind regards,
Louis