Open report with criteria

fluidmind

Registered User.
Local time
Tomorrow, 00:16
Joined
Jun 30, 2006
Messages
66
Hi folks!

When you fx make a button to open another form, you can choose to open it only containing data where a variable is equal to fx a textbox in the form where the open-form-button is placed.

That's what I want my report to do too. But i don't get that option, when I create an open-report-button. I want to open a report containing emplyee-stats, but I only want the report to show the stats for the selected employee. I know it can be done... But how?

// JR
 
Go to the query for the report and put forms!Formname!txtEmployee in the criteria section. Where Formname is the name of your form calling the report, and txtEmployee is the text control with the employee id.
 
Under DoCmd.OpenReport within Access help is a pretty helpful explanation of how to use filters when opening reports, via VBA. (It must be clear if I was able to use it ;) ).

You can either save a filter, or use a string (e.g. "name = 'Smith'").
That would allow you to pick a name from a list on some form and to construct the string, before using the OpenReport command.

Hope that helps.
 
You're my heroes :-)

Hi guys!

Thanks for your replies... And so quickly - WAW! It tried you version suggestion first, Matt - It seemed easier. But I couldn't get it to work (probably did something wrong :-)).

Jibbadiah - Your suggestion was the winner :-)

Thanks again!
 

Users who are viewing this thread

Back
Top Bottom