Report filter directly out of a form

R

René

I have a main client and employee form.

I would like to create a command button that on click would filter the report to show only the information pertaining to the particular client or employee

I am currently reading through the Running Access 2000 book, but am not quite sure what to call what I'm trying to do so that I can look it up :)
 
C

Cheryl Fischer

You will need to add a Where Condition to the OpenReport method. Something
like the following:

Dim strCriteria As String

' This works when your matching field is text
strCriteria = "[CustID] = " & Chr(34) & Me!CustID & Chr(34)
DoCmd.OpenReport "MyReport", acViewNormal, , strCriteria

' This works when your matching field is a number
strCriteria = "[CustID] = " & Me!CustID
DoCmd.OpenReport "MyReport", acViewNormal, , strCriteria

hth,

--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


René said:
I have a main client and employee form.

I would like to create a command button that on click would filter the
report to show only the information pertaining to the particular client or
employee.
I am currently reading through the Running Access 2000 book, but am not
quite sure what to call what I'm trying to do so that I can look it up :)
 
J

Jeff Boyce

René

Not sure how this is a "tablesdbdesign" question...

You can add code to the Click event of your command button that opens the
report, filtered for the record currently being displayed in the form.

Take a look in Access HELP at the syntax explanation for the
"DoCmd.OpenReport" command.
 

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