Passing and Displaying Formatted Report Criteria to MSAccess Print Preview

  • Thread starter Thread starter Barry G. Sumpter
  • Start date Start date
B

Barry G. Sumpter

Hi all,

I'm attempting to preview a report using MSAccess Run-Time Only from Visual
Basic 6.

I have report criteria like:

UserName = "Barry"
FromDate = "2003 08 04"
ToDate = "2003 08 04"

strRptName = "Time Card"

strWhere = "UserName = 'Barry' and DateNum >= 37837 and DateNum <= 37844

strFilter = "" 'no filter

intDisplay = acPreview

objAccess.DoCmd.OpenReport strRptName, intDisplay, strFilter, strWhere

On the Time Card report I have a control named "FormattedReportCriteria".

I want to pass my formatted criteria text to the "FormattedReportCriteria"
control (textbox or label):

User: Barry
From: August 4, 2003
To: August 4, 2003

Does anyone know how?

__________________
Thanks,
Barry G. Sumpter
(e-mail address removed)
 
Hi Allen,
Thanks for the response.

Could I verify that you understand that I'm executing a MSAccess 2000
Report
from VB6?

Thanks,
baz
 
One method might be to place the value in a one record table. Then use this
table as the record source for a subreport. Or, if the table is only one
record, you could place the table in the original report's recordsource (no
joins).
 
Hi Allen and Duane,

I've got 300 users.

In your examples, how do I tell the msaccess report which user record to
use?

A bit more lateral thinking:
the PARAMATER in sql looks promising:

I can base my Report on this query:

Paramater rptCriteria Text;
Select * from tblCompanys;

and by using the .OpenReport MSAccess prompts for rptCriteria

but if I use:

Paramater rptCriteria Text = Requesting User is: Barry;
Select * from tblCompanys;

then MSAccess does NOT prompt for rptCriteria
and I can use rptCirteria of "Requesting User is: Barry" as the
datasource for my text box

But I can't figure out how to change the datasource for the report
on the fly for 300 users using .openreport....

I've attempted variations on the Filter with no avail...


Any further suggestions would be met with great inthusiasm.


baz
 
Back
Top