Parameterize Report

A

Anna

Hi:
I create three drop down of ddlname,ddladdress,ddlaccount and two
textboxes name txtdate1,txtdate2. My original table name is customers
with fields:

1.serialno autonumber
2.name
3.address
4.account
5.reqdate Date

Can any one please help me how to i pass a filter data into my report
name custrpt. I want to give option to user either she select 1 or more
then one field from my form, the query will run and pass the parameter
values into my report.

Thank You.
 
P

pietlinden

If I understand this right...
You check the various controls that you want to filter for nulls. If
they're not null, you add them to you filter criteria by creating...
here. here's an example.

dim strFilter as string
const cQOUTE = "'" (a single quote in double quotes)
if not IsNull(Me.ctlText) then
strFilter = strFilter & "[SomeFieldInReportRecordSource]=" & cQUOTE
& me.ctlText & cQUOTE

there are some examples, I think. at www.mvps.org/access

basically, you build your filter (strFilter) on the fly by appending
criteria. Once that's built, you pass that as your filter when you open
the report. (See DoCmd.OpenReport. One of the parameters is a filter
(just a valid where clause without the word WHERE).
 

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

Top