Auto clean fields in linked objects

Hello everybody!

I am new in the Access world so i would really appreciate some help.

I am currently working on a main form in Access 2010 which includes quiet a lot of fields, therefore i choose to create parts of it (which are as well optional, as they do not apply to all records) as different forms which i linked to the "mother" form afterwards through a checkbox by using the following code:

Private Sub chkMajor2_Click()
Dim strformname As String
If Me.chkMajor2 = True Then
strformname = "Major 2"
DoCmd.OpenForm strformname, acNormal
End If


continued with..

If Me.chkMajor2 = True Then
chkMajor3.Visible = True
Else
chkMajor3.Visible = False

End If

End Sub


to make the next form visible for selection after filling in the current one...something like an "add more.." field actually, which i choose to represent as checkbox. Please find bellow an image of it in case i didn't explain myself good.

The issue that i encounter is that when i click the "Add New" button in the main form, it doesn't clear also the fields in the linked forms. Is it possible to do that with a VBA code? Or how should i proceed?

The current code that i have for the button is:
Private Sub cmdNew_Click()
DoCmd.GoToRecord , , acNewRec
End Sub



Thank you in advance!


Alice


img-1.jpg
Alice VuapAsked:
Who is Participating?
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.

Rey Obrero (Capricorn1)Commented:
i think you will have more control if you create a form with Tab Control or multiple pages.

see this link
https://support.office.com/en-za/article/Create-a-tabbed-form-6869dee9-3ab7-4f3d-8e65-3a84183c9815
1

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
Alice VuapAuthor Commented:
Dear Rey,

Thank you for your reply. I've seen the Tab Control before but i don't find it that friendly. I would like to keep the extra fields in a pop up dialog. Is it any way that i can solve my problem while keeping it in the initial format?
0
Dale FyeCommented:
Agree with Rey that the "best" way to include additional data in a form, that is all tied to the same record is to use tab controls.
You could give one tab a caption like "Required" and the other tab a caption like "Optional".

Another issue is that you are going to have to save the current record before you open that second form, or you will end up with write conflicts when you attempt to close the popup form.
1
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Alice VuapAuthor Commented:
ohh, i see! I didn't think of conflicts. I will give it a try then! Thank you both!
0
Rey Obrero (Capricorn1)Commented:
@Alice
Welcome to EE..
0
Alice VuapAuthor Commented:
Thank u! :)
0
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
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.