Re: finding data
- From: "Rick Brandt" <rickbrandt2@xxxxxxxxxxx>
- Date: Tue, 06 Jun 2006 13:51:19 GMT
jman wrote:
I am an intern at an engineering firm that is trying to create a
database of comanies' online catalogs and trashing the paper
versions. I have tought myself a little MS Access and created a table
then ran AutoForm and a little manual design to create a form in
which I have entered various information for the individual companies.
My question is how do I set up this database so when you open iti you
are asked for a company name, it then searches for that company name,
and displays the entry? Ideally, I would like to make it able to
search any of the fields but I would take just being able to search
the company name.
I already know how to use the find command when in the form and
search it that way, but I would like the database to just start up
asking what you would like to find and I don't have a clue how to go
about doing that. Any help would be greatly appreciated.
Easiest solution...
In form design view make sure the Toolbox wizard is enabled (magic wand
button depressed). Then drop a new ComboBox control onto the form. One of
the choices in the Wizard will allow you to create a list of company names
and when a selection made the form will be navigated to that matching
record. This will be the third choice in the first page of the ComboBox
wizard. This ComboBox can be named/labelled with "Go To..." or similar.
More efficient solution...
Open the form initially with zero records displayed. Easiest way to do that
is to set the DataEntry property of the form to Yes. That will cause it to
open to a single blank record. Then a ComboBox displaying the company names
can be built and placed in the header. This would have the same RowSource
as the one you would build with the wizard above, but instead of navigating
to the desired record we will use code that filters for that record instead.
The AfterUpdate event code for the ComboBox would look like...
Me.Filter = "CompanyName = '" & Me.ComboBoxName & "'"
Me.FilterOn = True
The effect is similar, but if the table is large and/or you are running this
app over a LAN then the second method should pull less data over the network
while being used. If the table is small or the whole thing is being run
from local disk there should be little difference.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
.
- Prev by Date: Re: Dual Primary Keys
- Next by Date: Re: Comparisson
- Previous by thread: Re: Dual Primary Keys
- Next by thread: Re: Comparisson
- Index(es):