filtering info for a report

  • Thread starter Thread starter Dave B
  • Start date Start date
D

Dave B

Hi,

I am currently trying to create a way of opening a report so that only the
details are displayed from selection i made whilst in my locating form. I
can do this if i wish to locate the details in a form format by using the
wizard, so i am guessing it is possible to be it for a report.

Any help would be greatly appreciated,

Thanks

Dave
 
Dave,
You will need to add a Where Condition to the OpenReport method so that the
report shows only the information for the record displayed on your form.
For example, if the current record on your form was for a particular
customer, you could use the CustID field to determine the where condition as
follows:

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,
 

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