I have a form, and i want to run a report from the form on a button, but i want to run the report using the current record. Could I have some clues to do that?
Should be easy, but we'll need to know a lot more to be able to help you.
What table is the form from? What table contains the data you want to report on? If different, how are they related? What do you want the report to show?
You'll need to supply some clues yourself first.
Please describe your report and how the current record controls what appears in that report.
okay i am on the event form which is tied to the event record i want buttons on that form to open reports based on the same event. Those bottom buttons i want to go to separate report layouts. The records i want to print are in the Event Art join table. I figure i can get those easily enough but i am not sure how to pass the current event id to the reports.
I'm understanding you're on "Events", and you already have related records "Event Art", and that's what you want to see listed in a report.
Your script behind the button would be:
If [ Count ( EventArt::id ) = 0 ] #note: it just has to be a field in EventArt that is guaranteed to have a value, so key fields are best
Show Custom Dialog ["There's no art for this event!"]
Go To Related Records [ From Table: "EventArt"; Using Layout "MyReport"; New Window ]
Sort Records (optional)
enter preview mode (optional)
There are three basic approaches that can be used depending on the data in your system, the relationships and what you want to see on your report.
GTRR as Jason has recommended is one and a good choice for his example
You can also use Data from the current record to perform a find by either
a) passing the data in a script parameter (and you can pass multiple values in such a parameter)
b) Setting variables to the values from your current record
Your script then changes to the report layout and uses the script parameter or variables to set up find criteria before performing the find.
The button just changes layouts. If your report layout is based on the same table occurrence as your first layout, the current record in one layout will be the current record in the report layout.
Retrieving data ...