Verify Value in Text box on Subform

S

Shel

How do you check that a value has been entered into a field on a sub form
from the main form?

for example:
Form1 contains subform2
subform2 contains Field 1

I have a command btn on Form1 that when clicked should check for a value in
Field 1 and return a message if Field 1 is empty.

Please help!
 
K

Ken Snell [MVP]

Private Sub ButtonName_Click()
If Len(Me!subform2![Field 1].Value & "") = 0 Then
Msgbox "Enter a value in the textbox"
End If
End Sub

Note that subform2 in the above expression must be the name of the subform
control (the main form's control that actually holds the subform).
 
S

Shel

Thanks a bunch, Ken.

Ken Snell said:
Private Sub ButtonName_Click()
If Len(Me!subform2![Field 1].Value & "") = 0 Then
Msgbox "Enter a value in the textbox"
End If
End Sub

Note that subform2 in the above expression must be the name of the subform
control (the main form's control that actually holds the subform).
 
Top