Link to home
Start Free TrialLog in
Avatar of Chrisjack001
Chrisjack001Flag for United States of America

asked on

Auto populating multiple fields

I have a form called “Scheduling-Add”. When the user wants to add a new “Study” that is not in the system they click the “Studies” button on the form which opens another form called “Studies-Add” . When the user is filling the details on this form for the new studies, the record is automatically populated with a “studyAutoNbr” which is also the primary key in the upper right field of the form next to the “Close” button. This “studyAutoNbr” is automatically populated in the “Protocol Nbr” field. I also want this number populated in the “Study ID” field. Example if the new record about to be created has a new “AutoID” of 12355. This same ID “12355” is populated in the “Protocol Nbr” field and should be populated in the “Study ID” field. How can I accomplish this goal. Attached is a copy of my database with the form. Thanks in advance.
Invoice-7-7-2001-91611.accdb
Avatar of Mudasir Noorani
Mudasir Noorani
Flag of United Kingdom of Great Britain and Northern Ireland image

Hello Chrisjack001,

I downloaded your database and had a look at the form_load event of the Studies-Add. Since the text box that represents Study ID is called Text39 (this is not a good convention, you could do better by changing the name of this text box to something like txtStudyID), you can add the following snippet after the first line of code in the form_load event:

Me.Text39 = Me.txtProtocolNbr

and it will resolve your problem.

Hope that helps.

ref-IT
Avatar of Chrisjack001

ASKER

So will that number populated in the “studyAutoNbr” automatically populate in both the protocol and studyID fields?
where should I put this code. In what property event?
ASKER CERTIFIED SOLUTION
Avatar of Mudasir Noorani
Mudasir Noorani
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks