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.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mudasir NooraniSenior Analyst ProgrammerCommented:
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.

Chrisjack001Author Commented:
So will that number populated in the “studyAutoNbr” automatically populate in both the protocol and studyID fields?
Chrisjack001Author Commented:
where should I put this code. In what property event?
Mudasir NooraniSenior Analyst ProgrammerCommented:
yes it will autopopulate both the protocol and the studyID fields. Like I mentioned before, you should put that piece of code after the first line of the code in the form_load event of the Studies-Add form.

This is what your form_load event should look like:

Private Sub Form_Load()
    Me.txtProtocolNbr = Me.StudyAutoNbr
    Me.Text39 = Me.txtProtocolNbr
End Sub

Hope this helps.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chrisjack001Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.