a special type of search form

From: Damien (youwish_at_nospam.com)
Date: 09/22/04


Date: Wed, 22 Sep 2004 06:18:18 -0700

The list of all records you saw was probably a ListBox.
You can populate it using a query or table and use it's
double-click event to open a form based on the record that
has been clicked:

eg

Private Sub List1_DblClick(Cancel As Integer)

    'Open the detail form based on the value that has been
double-clicked on the main form ListBox List1
    DoCmd.OpenForm "frm_detail", acNormal, , "staff_id = "
& Me.List1
    
    'Use quotes for strings eg
DoCmd.OpenForm "frm_detail", acNormal, , "staff_id = '" &
Me.List1 & "'"

End Sub

You can also set criteria in your query based on values on
your form. For example if form frm_main has a ComboBox
cmbTitle, you can set crtieria in your query like:

SELECT * FROM staff
WHERE staff_title = [Forms]![frm_main]![cmbTitle]
OR surname = [Forms]![frm_main]![txtSurname]

If you then set the RowSource of your ListBox to the above
query, and Requery it using a CommandButton:

PrivateSub cmdSearch_Click()
    Me.List1.Requery
End Sub

you should see the records in your Listbox change
according to the criteria you have entered.

It starts to get a bit more complicated from there, but
hopefully you get the idea !

Let me know how you get on.

Damien

>-----Original Message-----
>I used a database a while ago and it had this function
which I'll explain
>below - I'm wishing to be able to create it, although
have tried a number of
>ways with no success.
>
>This is a form which is used to locate specific records.
At the bottom of
>the form would be a list of every record in the database,
where if one
>clicked on any record, a specific form would open up,
displaying the
>extensive information on that record. At the top of the
form there were
>several fields where one enters in the values they wish
to match from the
>data in the database (eg name, date, company, etc), each
of them having a
>button next to it to update the list below, hopefully to
cull it down to a
>few so that one can be selected from simply inspecting
which is relevant. It
>sounds like a filter set up, but I'm not sure how to set
this up. Nor do I
>know how to have it so you could dbl click on one of the
records in the list
>to open up a form displaying the more extensive details.
>
>This may sound confusing, I hope it isn't too bad, coz I
hate reading long
>things, so thanks if you got to here. Any ideas, as you
may tell, would be
>greatly appreciated. Thanks
>
>- Matt
>.
>