Where condition macro for a report (1 Viewer)

bevc

Registered User.
Local time
Yesterday, 23:00
Joined
Jul 30, 2015
Messages
19
This is going to be an easy/dumb question for someone smarter than me to answer, I hope. I only work on Access occasionally, and I always forget what I've done before, and feel like I have to re-learn everything every time.

I want to print some name badges for events.

I have a table and form for the events and a table and form for the contacts. Users created an event in the events form, and from the contact form they select whether the contact is attending. I have set a sub-form in the events form that lists attendees (can't exactly remember how, but I did).

I have formatted some name badges in a report.

Fundamentally all I want to do is have an on-click event that filters the name badge report down to just the list of attendees. I have a query that does that, I think.

I thought it would be as simple as creating an on-click macro with a where condition, but when I use the where condition

[FrmEvents]![ID]=[QryEventsAttendees]![TblContacts]![EventsAttended]

and I click the button, the thing asks me for the parameter of '[Frm Events]![ID]', even though it's right there, like, 2cms from the dialog box! I don't know if it's something really simple like I have to put quote marks round part of the text in the where condition or something, or link master-child fields, or what.

I don't really know what I'm doing, I've reached access-newb-burnout for the day, apologies for any lack of clarity. If anyone could help me I'd be very grateful. Thanks.
 

BitsOfBytes

Registered User.
Local time
Today, 02:00
Joined
Apr 14, 2015
Messages
15
You could build it all in a new query that selects attendees for that event. The on-click event would just print the report based on that new query. You can keep the name bagde report you already made, just change the data source to your new query that selects attendees.

Create a query on your TblContacts and in the criteria for [EventsAttended] place [FrmEvents]![ID]

Essentially whatever event ID is displayed on your form would create the where clause for the query.
 

bevc

Registered User.
Local time
Yesterday, 23:00
Joined
Jul 30, 2015
Messages
19
You could build it all in a new query that selects attendees for that event. The on-click event would just print the report based on that new query. You can keep the name bagde report you already made, just change the data source to your new query that selects attendees.

Create a query on your TblContacts and in the criteria for [EventsAttended] place [FrmEvents]![ID]

Essentially whatever event ID is displayed on your form would create the where clause for the query.

It took a little bit of faffing around, but that did work, thank you very much!
 

Users who are viewing this thread

Top Bottom