Autocompleting fields

DrMaestro

Registered User.
Local time
Today, 15:02
Joined
Feb 3, 2007
Messages
21
Hi,

I created a simple table consisting of an identification number field (pid), name field (Ptname), and surname field (Ptsurname). The identificaiton number is an 11 digit number, unique for every person. The database is empty. The users are going to fill it using a form consisting of previously mentioned fields. After entering the ID number, I want the database to be able to fill the name and surname fields automatically if a previous record exists. How can I achieve this? Thanks in advance...
 
Use a SELECT statement or a DLookup for Name and Surname and place code to update the controls in the AfterUpdate of PID, something like this:

PTName = DLookup("PTName_Field","YourTableName","PID=" & NameOfPIDField)
PTSurname = DLookup("PTSurname_Field","YourTableName","PID=" & NameOfPIDField)

They will return NULLs if the PID doesn't exist in your table. Otherwise, they will return the information you're looking for.
 

Users who are viewing this thread

Back
Top Bottom