search for a specific record on a form

V

Vincent

hello,

i am a beginner with access. i have just created a DB (the kind of Project
- Project Responsible - Client kind of things) where i obviously have a
central table for the projects, linked to the customers, the employee and
other projects related informations.

i've created a form so that the employeed can see at once all the
information relevant to their project (info coming from several table) but i
don't know how to do to give them a simple way to find all the information
relevant to a specific project. What i would like is a kind of box on the
form where they could type the file number they looking for and then see all
the data linked to this file number appear on the form.

thank you very much for your help !
 
A

Allen Browne

How about an unbound combo box that lists the projects? When you select one,
it jumps to that record.

There is a combo-box wizard to do that for you, or if you prefer to program
your own, see:
Using a Combo Box to Find Records
at:
http://members.iinet.net.au/~allenbrowne/ser-03.html


If you want a solution that involves no programmaing, you could move the
cursor into the ProjectID field, and use the Find button on the toolbar
(binocular icon).
 
V

vincent

thanks for your quick answer...

the programming part seems a bit tricky for me so early ...
as for the combo box i tried... and i still can't manage to get it right. i
go into the design view, on the toolbox i select a combo box and i follow the
wizard. there i chose that the box should display the file number of my
project table (the center of the DB) and it does it but that's all it do...
it doesn't jump to any record when i use it, it just display the file number
i choose and that's it...

what have i done wrong ?

thanks
 
A

Allen Browne

When the wizard finishes, you will end up with a RowSource that is a query
statement into your table. This statement could return several fields. Look
at the BoundColumn property of the combo to determine which of those fields
is the value of the combo. Then the code in the AfterUpdate event procedure
of the combo should FindFirst based on that field.
 
V

vincent

Hi again...

i don't really see what you mean by this : "Then the code in the AfterUpdate
event procedure of the combo should FindFirst based on that field."

i found the AfterUpdate event all right in the properties but i don't
understand what i should do there... what is this "FindFirst" thing ?

thanks !!
 
C

closkey

I want to do something similar to what vincent is asking. I currently have a
"FIND" button on my form. How can I program the button to automatically come
up with the "LOOK IN" field as the same field every time, no matter where the
cursor is on the form? I think a Combo box would do the trick, but would
rather not have the user have to scroll through all the entries.

Thanks.
 
A

Allen Browne

Set the After Update property to:
[Event Procedure]

Click the Build button (...) beside that.
Access opens the code window.

The code that goes between the lines "Private Sub..." and "End Sub" will be
similar to that provided in the link in the earlier reply.
 
V

vincent

ok thanks you very much for your answers Allen !!

i finally made it and used this code :

Private Sub FileNumberSrch_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[FileNumber] = '" & Me![FileNumberSrch] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

where [filenumber] is the field in my table and [filenumbersrch] is the name
of my combo box

Thanks again !

Allen Browne said:
Set the After Update property to:
[Event Procedure]

Click the Build button (...) beside that.
Access opens the code window.

The code that goes between the lines "Private Sub..." and "End Sub" will be
similar to that provided in the link in the earlier reply.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

vincent said:
Hi again...

i don't really see what you mean by this : "Then the code in the
AfterUpdate
event procedure of the combo should FindFirst based on that field."

i found the AfterUpdate event all right in the properties but i don't
understand what i should do there... what is this "FindFirst" thing ?

thanks !!
 
Top