Data Entry, lookup existing

J

John Keith

I am trying to set up a simple data entry form. The 1st field (ssn) is the
primary key. I would like to have the form detect when the SSN entered
already exists an load this data into the form. The default is that the form
wait till after the user tries to navigate to a new record before the record
is checked against duplicate key constraints.

This is currently set to be a continuous form with Data entry set to true.

How do I make the form just fill in the blanks after the cursor leaves the
SSN field IF it points to a pre-existing record.

Will i need lookup code in the lost focus event? or should I use filtering?
or ???
 
D

Dymondjack

It sounds like the purpose here is to make sure the ssn doesn't already exist?
You could do that on the Exit or LostFocus event of the control (it would
catch it before the Form_BeforeUpdate would notify you of a duplicate primary
key).

As far as filling in blanks for pre-existing records, I can't imagine why
you would do this. If the record already exists, there's already information
that the form should be showing. Maybe you are looking for "If the user
enters a SSN that's already there, goto that record?"

Either way, a Dlookup function that returns anything but Null would indicate
a pre-existing record, and the Bookmark property will bring you to a
specified record if it does already exist...

hth
-jack
 
D

Dymondjack

It sounds like the purpose here is to make sure the ssn doesn't already exist?
You could do that on the Exit or LostFocus event of the control (it would
catch it before the Form_BeforeUpdate would notify you of a duplicate primary
key).

As far as filling in blanks for pre-existing records, I can't imagine why
you would do this. If the record already exists, there's already information
that the form should be showing. Maybe you are looking for "If the user
enters a SSN that's already there, goto that record?"

Either way, a Dlookup function that returns anything but Null would indicate
a pre-existing record, and the Bookmark property will bring you to a
specified record if it does already exist...

hth
-jack
 

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