Data Write to Second Subform

notrino

Registered User.
Local time
Today, 23:19
Joined
Oct 18, 2018
Messages
26
Hello,

I attached my application, I want to wirte "5" to textbox from click button event. But I couldn't sort the code. Thanks.
 

Attachments

Hello,

I attached my application, I want to wirte "5" to textbox from click button event. But I couldn't sort the code. Thanks.
#
Me.TextBoxName = 5
#
Should do the job done


Sent from my Redmi Note 4 using Tapatalk
 
Well, button is on main form and textbox is on subsubform - this will get a bit tricky. Must reference subforms through the containers that hold them. You have to go through two subforms.

However, there is something very wrong with Form1. Could not get any code in the button Click event to work, not even a simple Debug.Print "Test". Deleting and replacing the button didn't help. Had to build a new form. Then this worked:

Private Sub Command0_Click()
Me.Form2.Form.Form3!Textbox0 = 5
End Sub

I normally given container control a name different from the object it holds, like ctrForm2. Then code is:

Private Sub Command0_Click()
Me.ctrForm2.Form.ctrForm3!Textbox0 = 5
End Sub
 
something like:

Private Sub Command0_Click()
Me!Form2!Form3.Form!textbox0 = 5
End Sub
 
Or even this one:

Me.Form2!Form3!Textbox0 = 5
 

Users who are viewing this thread

Back
Top Bottom