Hello,
So I have a checkbox in a subform that if a user checks then the address info from the main form should be transferred to fields the subform. Here is my code:
Private Sub Check5_Click()
If Check5.Value = -1 Then
add.Text = Me.Parent.add.Text '*
city.Text = Me.Parent.city.Text
prov.Text = Me.Parent.prov.Text
postal.Text = Me.Parent.postal.Text
End If
If Check5.Value = 0 Then
If add.Value <> "" Then
If MsgBox("Are you sure you want to change this info?", vbInformation + vbYesNo, "Confirm")= vbYes Then
add.Text = "" '*
city.Text = ""
prov.Text = ""
postal.Text = ""
End If
End If
End If 'added this end if to stop the Block without End If error
End Sub
First, any idea why I need that 'End If' comment??? The code won't run without it.
Second, I keep getting a "Can't reference a property or method unless the control has the focus" on the lines commented with a *. Why is that??? I'm certain I've done this before in VB but haven't run into these sorts of errors before.
Am I referenceing something improperly??
Thanks
Brian
So I have a checkbox in a subform that if a user checks then the address info from the main form should be transferred to fields the subform. Here is my code:
Private Sub Check5_Click()
If Check5.Value = -1 Then
add.Text = Me.Parent.add.Text '*
city.Text = Me.Parent.city.Text
prov.Text = Me.Parent.prov.Text
postal.Text = Me.Parent.postal.Text
End If
If Check5.Value = 0 Then
If add.Value <> "" Then
If MsgBox("Are you sure you want to change this info?", vbInformation + vbYesNo, "Confirm")= vbYes Then
add.Text = "" '*
city.Text = ""
prov.Text = ""
postal.Text = ""
End If
End If
End If 'added this end if to stop the Block without End If error
End Sub
First, any idea why I need that 'End If' comment??? The code won't run without it.
Second, I keep getting a "Can't reference a property or method unless the control has the focus" on the lines commented with a *. Why is that??? I'm certain I've done this before in VB but haven't run into these sorts of errors before.
Am I referenceing something improperly??
Thanks
Brian