Search records that will show up in a list box on a form.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a form that does nothing but find records. I have created
command buttons that look for specific criteria from the table I created. I
don't want the records to show up in a pop-up query table. Is it possible to
insert a report in a form? Or, is it easier to have a report pop-up
automatically when the search is complete? Could I use a list box as a report
on the form? I prefer the latter, but I also want the easiest way to
accomplish this requirement.

Thanks,
James E.
 
Hello James.

j1eggert said:
I have created a form that does nothing but find records.
I have created command buttons that look for specific criteria from
the table I created. I don't want the records to show up in a pop-up
query table. Is it possible to insert a report in a form?

No, sorry.
Or, is it easier to have a report pop-up automatically when the
search is complete?

Yes, you could create a query that uses your criteria and base a report on
your query,
or base the report on all records and pass the WhereCondition parameter to
the OpenReport method.
Could I use a list box as a report on the form?

Yes, set the RowSource property of the listbox to the query that searches
the records.
When the user clicks your "find" button, the listbox should be requeried.
I prefer the latter, but I also want the easiest way to
accomplish this requirement.

What about using the form itself:
Place your buttons in the header of the form and change the Filter property
of the form using the appropriate criteria.
 
Thanks for your help, but I have a couple of additional questions.
On the form the command buttons are linked to specific macros that are tied
to update queries. When I click on a command button the "Enter Parameter
value" window pops up. When you enter the value it automatically brings the
query table up. I did specify the query in the row source which holds the
records, but it does not place the information into the list box. What is the
step I am missing to accomplish this task?

The final suggestion you made about using the form itself sounds good;
however, I have not used Access in a while and was wondering if you could
give me a little more detail on what criteria I would need to use for the
filter property and how to set the form up appropriately to meet my
requirements. THANKS!
 
Hello James.

Thanks for your help, but I have a couple of additional questions.
On the form the command buttons are linked to specific macros that
are tied to update queries. When I click on a command button the
"Enter Parameter value" window pops up. When you enter the value
it automatically brings the query table up. I did specify the query
in the row source which holds the records, but it does not place the
information into the list box.
What is the step I am missing to accomplish this task?

How about a textbox "txtFltVal" instead of the "Enter Parameter" window?
You can use a command button to apply the filter as in the example:

Private Sub cmdFilter_Click()
lstMyListbox.RowSource = _
"SELECT Fld1, Fld2 FROM Table1 WHERE Fld3 = '" & txtFltVal & "'"
lstMyListbox.Requery
End Sub
The final suggestion you made about using the form itself sounds good;
however, I have not used Access in a while and was wondering if you
could give me a little more detail on what criteria I would need to use
for the filter property and how to set the form up appropriately to
meet my requirements. THANKS!

You could place the textbox and commancbutton from above in the form header.
Set the RecordSource of the form to a query/table that returns all records.
The event procedure for the filter button could look like this:
Private Sub cmdFilter_Click()
Me.Filter = "Fld3 = '" & txtFltVal & "'"
Me.FilterOn = True
End Sub
 
Back
Top