auto fill form

laurat

Registered User.
Local time
Today, 22:43
Joined
Mar 21, 2002
Messages
120
I have a form where different users will enter in data. The primary key for this form is a number field. The users would like to be able to go to the form and type in a number in that field and if a record already exists for that number they want the rest of the data that was already entered to fill in. If that number does not already exist the form will remain blank and they will proceed and enter in the remaining information. My problem is that I am not sure quite how to go about it. I thought about writing an if statement in the AfterUpdate() section of the primary key field that will check if the number exists and if so pull up the data. I am not sure if this right or exactly how to write it.

An addition aspect that add confusion. On another form this same field is combined with another field to make the primary key. Users would like to be able to pull up and scroll through all records that have the same number in the first field of the primary key.

I am sorry if this all sounds confusing but any help would be appreciated. Thank you.
Laura
 
Have you considered running the report off of a query?

Provide your users with a query driven report the prompts for the KeyField

Like [Enter the Number Field you would like to add or edit: ]

Then when the users enter the form they will see all of the record that share the One KeyField that you group the records by (the other half of the key will not be a problem), and then if they would like to add records, they may do so after scrolling through the existing MATCHING entries. If no records match...then they are simply provided with a blank form!

I thought of a much longer way of doing it, but it sounded like you wanted to perform this function in a simple way...so this is my simple solution!!

If you need clarification or want to see an example...I have a little test database that I could send.

REF: RestrictForm.mdb
 
Thank you for the help Adrianna. If you could explain in a little more detail or send that sample that would be great. I am not sure that I completely understand your solution but it sounds as if it will work. Thank you.
Laura
 
Okay,
This is as simple as I can get it to keep it small. My table is made up of four fields, two of them create the multi-indexed key! When you search for [ID] (which is indexed with [Page]), you are able to view all of the [ID] fields, regardless of the Page numbers.

I think those where the two criteria that you wanted to meet. Let me know if I've left something out. If you wanted something a little more suffisticated, then there are always other approaches!
 

Attachments

Thank you for your help. However, this database got pushed aside right now and I am making some updates to another database. I will try out your suggestion when I get a chance, and if I have any questions I will get back to you.

Thanks again:)
 

Users who are viewing this thread

Back
Top Bottom