Display 'Where' criteria passed from VB Code on an Access Report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a Access 2002 database with reports.

I am forming a query dynamically in my VB front end with 'where' condition,
and opening an access report using Docmd.openreport command.

For example:Acc.DoCmd.OpenReport "AllAssociationsOfAPersonAsOnDate",
acViewPreview, , where$
Here,where$ will be dynamically taking values from the vb form.

How can I reference the where condition in my access report.
Suppose I am sending a date in my variable where$, how do I show the date
that I have selected in my vb form, on the report?

I am not using VBA. I have a vb application using Access as database.

The dynamically formed where condition in the query will look like this:

WHERE (([TB_Role.Start_date] <= #2/1/2004# and( [TB_Role.End_date]is Null or
[TB_Role.End_Date]>= #2/1/2004#) ));



The question is how to display this selected date 2/1/2004 on the report?
How to reference this date in the report?

Any help will be appreciated.
 
The quick method is to add a text box on the report with a control source
of:
=[Filter]
If you want, you can use code or function expressions to parse date values
from the value of the filter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top