Default Value in a subform depend in the main form

joeschwa

Registered User.
Local time
Today, 14:28
Joined
Aug 24, 2015
Messages
10
i have form 1, & form 2, & form 3
form 3 is a sub form to form1 and to form2
now i want to set a default value in field1 in the sub form form 3, but it's should be depend in the main form i open
if i open form1 than the field 1 in the sub form should be "1", & if i open form2 than should the field 1 in the sub form "2"

Thanks
 
Duplicate the Form3 and Name it Form4. Except for the name of the form everything else is the same. Attach Form3 as a sub form to Form1, Attach Form4 as a sub form to Form2 and then set the default values.

Otherwise you can enter some VBA in your Forms Form1 and Form2 to set the default value for the sub form when they open.

Private Sub Form_Open(Cancel As Integer)
Me.frm_FormThree.Form!text2.DefaultValue = 1​
End Sub​

Cheers!
Goh
 
Thanks for your respond

First I had to gat all on 1 Table for the reports later

but the code looks fine but its didn't work you want check if it's not any mistake (the name for the sub is: form3, & the name for the field is: field1)
thanks again
 

Users who are viewing this thread

Back
Top Bottom