Find Record VBA code Help

G

Guest

I need help in getting the following pseudo code working.
Thanks in advance.

procedure btnFind_Click()

Ask for Last_Name & First_Name
Search recordset (table)
If Record Count > 1
list all records in popup box
allow double-click selection of right person
populate form (not bound to table) that has the Find Button on it
ElseIf Record Count = 1
populate form (not bound to table) that has the Find Button on it
Else
display MsgBox "No Records Found" with OK
End-if

End procedure

Form is not bound to recordset (table) but has the same fields. A separate
button will and VBA code will handle Update Recordset functions.
 
S

strive4peace

Hi Ed,

rather than poplutating your form with information that is
already stored elsewhere, simply store the ID field of that
record and link to it when you need more information.

create an Autonumber field in the table with the names

ie: PeopleID, autonumber

then, store PeopleID (instead of names) in the related table

on your form, make a combobox:

Name --> PeopleID
ControlSource --> PeopleID
RowSource --> SELECT PeopleID , Lastname & ', ' & Firstname
as [Name_] FROM Tablename ORDER BY Lastname, Firstname
BoundColumn --> 1
ColumnCount --> 2
columnWidths --> 0;2 (etc for however many columns you have
-- the ID column will be hidden)
ListWidth --> 2 (should add up to the sum of the column widths)

PeopleID will be stored in the form RecordSource while
showing you names from another table...


Warm Regards,
Crystal
MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top