Passing List Box Selection to a separate Report (Query)

  • Thread starter Thread starter Nick Bygrave
  • Start date Start date
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
 
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.
 
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
________________________
 
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).
 
Back
Top