Passing List Box Selection to a separate Report (Query)

N

Nick Bygrave

I want to let a user select one record from a List Box on
a Form so that the Record No (the contents of a field in
the List Box row) is passed to a separate Query that will
select all the associated data for a single record report.

Is it possible to enter a reference in the Criteria for
the relevant field of the Report Query telling it to
extract only the record selected on the Form List Box -
that is without doing any programming in a module?

Any help would be appreciated
 
S

Scott McDaniel

You can try this in the criteria of your query:

Forms!NameOfForm.NameOfListBox.Columns(0)

Obviously you'll have to substitute the names of your forms/controls to
match those in your project, and you may have to adjust the column(0) to
reflect the appropriate column. Note that I'm not sure this will work; I
rarely use stored queries.
 
G

Gary Miller

Nick,

You can use the criteria line of the appropriate report
field in your query to refer to the value of the listbox on
the form as long as the listbox is not set to MultiSelect.

Criteria: Forms!YourFormName!YourListBoxName
--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
J

John Vinson

I want to let a user select one record from a List Box on
a Form so that the Record No (the contents of a field in
the List Box row) is passed to a separate Query that will
select all the associated data for a single record report.

Is it possible to enter a reference in the Criteria for
the relevant field of the Report Query telling it to
extract only the record selected on the Form List Box -
that is without doing any programming in a module?

Yes: use a criterion of

=[Forms]![NameOfTheForm]![NameOfTheListbox]

Be sure that the Record No is the Bound Column of the listbox, and
that the listbox is unbound (i.e. its Control Source should be blank).
 

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