richard said:
I have a form which is used to enter client data into a table. I wish to
use
a combo box to search for a clients name and then show the clients record
(address etc) into the other fields on the form from the original table
the
info was entered into.
I have tried queries to no avail and have no knowledge of code, so answers
in words of one syllable please
Thanks
It's difficult to keep it both simple and brief. Maybe this will give you a
starting point, and you can do further research in the newsgroups for more
details.
You need to add an unbound (no Control Source) combo box to your form and
set its Row Source property to show the list of clients. You should be able
to use the Combo Box Wizard to help you with this. You then need to create
an event handler for the AfterUpdate event of the new combo box (select the
combo box, open its Properties window, click on the Event tab, select [Event
Procedure] for the AfterUpdate event, click on the button with three dots
next to it). In your code, use the combo box value to locate the desired
record - something like this (assuming you're using DAO):
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[Client]=" & Me.cboClient
If Not rs.EOF Then
Me.Bookmark = rs.Bookmark
End If
If the client value you're looking for is text rather than numeric, you'll
need to add quotes around the value:
rs.FindFirst "[Client]='" & Me.cboClient & "'"
Of course, I don't know the name of the client field in your table or the
name you'll give to the combo box, so I just made up names.
To see if you're using DAO, at the top of the code window click on Tools ->
References and see if there is a selection starting "Microsoft DAO". If not,
scroll down until you find those entries and put a check by "Microsoft DAO
3.6 Object Library".
A similar process can be done using ADO, but I'm not as familiar with that
syntax.
Carl Rapson