View Full Version : report and form record selectors


dulija
03-15-2008, 02:26 PM
In short, I have a form base on query and on that form have command button. When I push button I get report generate from mentioned query. I want report show just data which record selector point on (it would be just one record).I have read about filtering data, but find nothing about create condition based on event Does anyone have some suggestion to solve this problem?

pbaldy
03-15-2008, 02:29 PM
Look at the wherecondition argument of OpenReport.

boblarson
03-15-2008, 02:30 PM
You would open your report by using this:

DoCmd.OpenReport "YourReportNameHere", acViewPreview,,"[YourIDField]=" & Me!YourIDFieldName

The YourIDField is the field in the recordset of the report you are going to open and YourIDFieldName is the name of the ID field for the currently selected record.

dulija
03-15-2008, 04:06 PM
I try and it works

THANKS

boblarson
03-15-2008, 04:10 PM
Glad we could help. :)

brandonh
03-17-2008, 09:20 AM
what if I want to do this, but a little more complex? I have a report that shows each person and all their quality scores under them. I want to have a form call the report with only the person selected, and the quality scores between a date range (instead of ALL the scores).

pbaldy
03-17-2008, 01:22 PM
"[YourIDField]=" & Me!YourIDFieldName & " AND DateField Between #" & Me.StartDate & "# And #" & Me.EndDate & "#"

brandonh
03-18-2008, 08:29 AM
thanks! i will try this out immediately!

brandonh
03-18-2008, 10:07 AM
THANKS! this works great in access, but I have my users running access runtime. Know of a way to let me display the reports without an error that closes the whole program?

pbaldy
03-18-2008, 10:13 AM
What error do you get? That code should work fine with the runtime version; virtually all my users are on runtime versions. Using runtime, you have to be more vigilant at using error trapping, as you've seen the result of not having it.