By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Want values in form to autofill when a new record is made. Which event?

rsmccli
P: 52
Access 2002

Hi, I have a number of comboboxes/textboxes in the header of a form that the user selects values from. These comboboxes/textboxes correspond to controls in a datasheet view subform. When a new record is created in the subform I want these values to automatically write to the new record in the subform.

Right now I have this autofill procedure running on the AfterInsert event of the subform. It works well, except for the fact that the user has leave the record before the values are updated.

Example:

Now: A user creates a new record by entering a SSN in that control. When the user tabs to the next control, no values are autofilled. The user must leave the current record for the autofill to work.

What I want: A user creates a new record by entering a SSN in that control. When the user tabs to the next control or clicks on another control on the same record, the values are autofilled.

I have considered some other events, but I definitely would not like access to overwrite anything if, say, the user clicked on a previously created record to change a mistake in the SSN.

I appreciate any help on this.

rsmccli
Apr 7 '08 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 374
Access 2002

Hi, I have a number of comboboxes/textboxes in the header of a form that the user selects values from. These comboboxes/textboxes correspond to controls in a datasheet view subform. When a new record is created in the subform I want these values to automatically write to the new record in the subform.

Right now I have this autofill procedure running on the AfterInsert event of the subform. It works well, except for the fact that the user has leave the record before the values are updated.

Example:

Now: A user creates a new record by entering a SSN in that control. When the user tabs to the next control, no values are autofilled. The user must leave the current record for the autofill to work.

What I want: A user creates a new record by entering a SSN in that control. When the user tabs to the next control or clicks on another control on the same record, the values are autofilled.

I have considered some other events, but I definitely would not like access to overwrite anything if, say, the user clicked on a previously created record to change a mistake in the SSN.

I appreciate any help on this.

rsmccli
The simplest way to do that is simply bind to the control of the other fields that you wan to auto-populate a DLOOKUP Statement and have it search on the Lost focus event of the SSN field. this way, you can have it populate as many fields as you'd like it to.

Hope that helps,

Joe P.
Apr 7 '08 #2

FishVal
Expert 2.5K+
P: 2,653
.....
Now: A user creates a new record by entering a SSN in that control. When the user tabs to the next control, no values are autofilled. The user must leave the current record for the autofill to work.

What I want: A user creates a new record by entering a SSN in that control. When the user tabs to the next control or clicks on another control on the same record, the values are autofilled.
........
Hi, there.

It pretty looks like you you are going to duplicate information which is generally unacceptable practice (Database Normalization and Table structures).
Form controls may be "autofilled" by using table join as form recordsource. Thus when user fills FK field bound control all controls bound to PK table are being populated to fulfill the join.

Regards,
Fish
Apr 7 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.