selecting one specific record for a report

  • Thread starter BBC via AccessMonster.com
  • Start date
B

BBC via AccessMonster.com

I need to be able to have the user print a specific record from a table ( and
its related sub-records). I'd like them to be able to select the record from
a descriptive combobox. They currently can multi-select reports to be
printed from my main screen and I'd like this one report to pop up a small
form with a descriptive combobox on it to select the specific record.

Is it possible to have a report open a form to provide the desc/key that will
be used to feed the query for the report (and its sub-reports) data. Becase
I use the common combobox on my mainform (report names are provided to the
multiselect by a query to a table) I don't want a special process for these
'select record from a combo' types. If the report cannot open a form can the
query provide the combobox. I've used queries to ask for a single entry (ex
date) but not via a combobox.
 
A

Allen Browne

You will need to be comfortable writing VBA code to achieve what you asked
to do.

You can open a form in dialog mode in the Open event of the report. This
pauses the code. The form will need to set a public variable (such as a
WHERE string.) When you close the form, the next line in Report_Open can
read the variable, and apply it as the Filter for the report.

Personally, I think it's simpler and more flexible to think about it the
other way around. If you design databases for others to use, you don't let
them use the Database Window/Navigation Pane, i.e. you always use forms as
the interface. Therefore you want to open a form where the user can enter
any criteria they want, choose the report to open, and then click a button
to open it.

If it's just a matter of printing one record, you can let the user find the
record, and click the button to print it. Here's an example of doing that:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html

To change the sort order of a report, set the Control Source of its
GroupLevel in Report_Open. Here's how:
Sorting report records at runtime
at:
http://allenbrowne.com/ser-33.html

The parameters in a query are not powerful enough to present combo boxes.
They are really not designed to be an interface at all.

To offer lots of filtering choices and build a Where string from whichever
ones the user chose, download the example from this article:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html
That example applies the filter to a form, but it's exactly the same to
apply it to a report.
 
B

BBC via AccessMonster.com

Thanks for allo the info.
Looks like this is what I needed to know and I appreciate the various
examples. Much easier to develop with good examples to follow.

I'm pretty good with VBA so not a problem. The application is already all
forms driven and the current reports are simply selected from the main form
but for a few reports I now need more filter criteria, but needed it
imbedded in the report or query to maintain my current user interface.
thanks

Allen said:
You will need to be comfortable writing VBA code to achieve what you asked
to do.

You can open a form in dialog mode in the Open event of the report. This
pauses the code. The form will need to set a public variable (such as a
WHERE string.) When you close the form, the next line in Report_Open can
read the variable, and apply it as the Filter for the report.

Personally, I think it's simpler and more flexible to think about it the
other way around. If you design databases for others to use, you don't let
them use the Database Window/Navigation Pane, i.e. you always use forms as
the interface. Therefore you want to open a form where the user can enter
any criteria they want, choose the report to open, and then click a button
to open it.

If it's just a matter of printing one record, you can let the user find the
record, and click the button to print it. Here's an example of doing that:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html

To change the sort order of a report, set the Control Source of its
GroupLevel in Report_Open. Here's how:
Sorting report records at runtime
at:
http://allenbrowne.com/ser-33.html

The parameters in a query are not powerful enough to present combo boxes.
They are really not designed to be an interface at all.

To offer lots of filtering choices and build a Where string from whichever
ones the user chose, download the example from this article:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html
That example applies the filter to a form, but it's exactly the same to
apply it to a report.
I need to be able to have the user print a specific record from a table
( and its related sub-records). I'd like them to be able to select the
[quoted text clipped - 15 lines]
can the query provide the combobox. I've used queries to ask for a single
entry (ex date) but not via a combobox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top