Yes, you can display a "search form" and collect criteria for use in an
underlying form. In one of my applications I have a dialog for selecting
which company's inventory,invoices,POs, etc that the user wants to view. I
did it this way(not the only way).
Set up a call to open your search form in the open event of the underlying
form. This call should be modal(meaning as long as the form is open all
processing stops on the code in the underlying form) so you want the
"WindowMode" to be dialog.
Example:
DoCmd.OpenForm _
FormName:="frmMySearchForm", _
View:=acNormal, _
WindowMode:=acDialog
The user enters their criteria in the search form, and you use it to set the
filter property of the underlying form, like so:
forms![MyForm].FilterOn = False
forms![MyForm].Filter = "MyField = " & Me.MyList.Value
forms![MyForm].FilterOn = True
The example I am giving only uses one criteria, you can use more than one
and define the criteria and concatenate on the extras with "AND/OR" very
similar to writing a SQL where clause. There are a lot of posts about using
more than one criteria in the filter/wheremode of a form or report, you can
google for them if you are stumped. Doing it this way enables you easily
change the criteria without closing the underlying form. You can put a
button on the underlying
form and recall your search form, enter new criteria and change the filter
property.
Another method would be simply open the search form first, select your
criteria and pass them in the command for opening the form by setting the
"WhereCondition"
Example:
DoCmd.OpenForm _
FormName:="MyForm", _
View:=acNormal, _
WhereCondition:="MyField = " & Me.MyList.Value
Sorry for the wordy response. HTH
--
Jeffrey R. Bailey
"N. Graves" <ng*****@yahoo.com> wrote in message
news:k3********************************@4ax.com...
Hi,
I want to have a Search Dialog box that has several text box and
fields to build a search and display the results in a form. I can do
everything that I need to if I us a report but I would like to have
the search from data displayed in a form.
The structure that I have for this was take from the Asset Manger from
MS. Anyway I open a report that in turn opens up a search form that
allow me to select data. Then you continue by clicking a button that
passes the data to a query that is used by the report.
If I use a form to do the same thing it seem to process the query for
the display form before it displays the search form.
Is there anyway to have a search form open another form and specify
what query info is searched for?
Thank You
Norris.