Clear fields in linked objects

alicevuap

New member
Local time
Today, 12:10
Joined
Jul 16, 2015
Messages
9
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 don'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
 

Attachments

  • img_1.jpg
    img_1.jpg
    91.8 KB · Views: 53
Look more closely at GoToRecord; you can specify the form.
 
Look more closely at GoToRecord; you can specify the form.

I tried but i didn't find a solution. Do you have any suggestion how can i approach it?
 
Yes, use GoToRecord twice, the second time referring to the second form.
 
I'm not sure how to refer to the second form..i tried by inserting forms("Major_2"). GoToRecord but it's not working... sorry, i'm a beginner in Access and in VBA so it would be useful if u could give me an example of a code because i didn't referred before to another object..
 
Thank you so much! I Googled as well but it seems that i didn't 'express' myself good :D I will try doing it asap!
 
No problem. It should also be in Access Help. I Googled "access gotorecord".
 
Hey! I just tried this option and it didn't work.. in the end i replaced the secondary forms with TAB controls on the "mother" form and it is working fine.

Thank you again for your time!
 
Glad you got it sorted.
 

Users who are viewing this thread

Back
Top Bottom