Set 2 criteria using LinkCriteria

F

FernW

How can I set 2 (or more) criteria using the LinkCriteria statement in VBA

I have a report with one LinkCriteria (CamperID) that works fine, but I need to set a second criteria (CampID)
Can this be done? If so, how

(I am trying to print a report from a form with MainForm that contains CamperID and SubForm that contains CampID
Without the link to CampID the report prints out a page for every record in the SubForm (every camp the camper has attended. I only want the current one.

Thanks for any help
Fer
 
S

Steve Schapel

Fern,

I am not sure about the "LinkCriteria statement", but I guess your code
will look something like this...

DoCmd.OpenReport "YourReport", , , "[CamperID]=" & Me.CamperID & " And
[CampID]=" & Me.YourSubformName.Form.CampID
 
J

John Vinson

How can I set 2 (or more) criteria using the LinkCriteria statement in VBA?

I have a report with one LinkCriteria (CamperID) that works fine, but I need to set a second criteria (CampID).
Can this be done? If so, how?

(I am trying to print a report from a form with MainForm that contains CamperID and SubForm that contains CampID.
Without the link to CampID the report prints out a page for every record in the SubForm (every camp the camper has attended. I only want the current one.)

Thanks for any help.
Fern

The WhereCondition operand (as well as the Filter operand) of the
OpenForm/OpenReport event should be a valid SQL WHERE clause without
the word WHERE: it can be almost arbitrarily complex. Try:

LinkCriteria = "[CamperID] = " & Me!txtCamperID & " AND [CampID] = " _
& Me!subMySubform.Form!txtCampID

or wherever you're looking for the criteria.
 

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