G
Guest
I have a form with several unbound text boxes presented to ask users to input
common data to be passed to several controls in several related records on a
subform. For example:
Main form
Dat1 text box
Dat2 text box
Dat3 text box
etc.
Sub form
Control1
Control2
Control3
Following is the code I am using in the On Click event in a Button control
to test the contents of each Dat control on the main form and update the
corresponding Control on the sub form is appropiate:
If Me.Parent.Dat1 > 0 Then
Me.Control1 = Me.Parent.Dat1
End If
If Me.Parent.Dat2 > 0 Then
Me.Control2 = Me.Parent.Dat2
End If
If Me.Parent.Dat3 > 0 Then
Me.Control3 = Me.Parent.Dat3
End If
..........
The main form presents over 20 different Dat controls. Is the code
structured properly or is there a better way to approach this task without
using over 20 If statements?
common data to be passed to several controls in several related records on a
subform. For example:
Main form
Dat1 text box
Dat2 text box
Dat3 text box
etc.
Sub form
Control1
Control2
Control3
Following is the code I am using in the On Click event in a Button control
to test the contents of each Dat control on the main form and update the
corresponding Control on the sub form is appropiate:
If Me.Parent.Dat1 > 0 Then
Me.Control1 = Me.Parent.Dat1
End If
If Me.Parent.Dat2 > 0 Then
Me.Control2 = Me.Parent.Dat2
End If
If Me.Parent.Dat3 > 0 Then
Me.Control3 = Me.Parent.Dat3
End If
..........
The main form presents over 20 different Dat controls. Is the code
structured properly or is there a better way to approach this task without
using over 20 If statements?