Set 2 criteria using LinkCriteria

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

Guest

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
 
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
 
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.
 
Back
Top