ian_ok
10-17-2001, 01:59 AM
I have two unbound box fields on a menu page and I want to disable the 2nd(End) until data is entered in the 1st(Start) - The second field is set to NO for enabled.
My code below doesn't work....Any help
Private Sub Start_Change()
If Not IsNull(Me.Start) And Me.Start <> "" Then Me.End.Enabled
Else
MsgBox "Enter date in box please"
End If
End Sub
ian_ok,
perhaps you mean:
... Then Me.End.Enabled = True
if you don't add the '= True', the property value will not be changed.
Hope that helps,
axa
Pat Hartman
10-17-2001, 09:43 AM
Try the following instead:
If IsNull(Me.Start) Or Len(Trim(Me.Start)) = 0 Then
Me.End.Enabled = False
MsgBox "Enter date in box please"
Else
Me.End.Enabled = True
End If
Rather than placing the code in the Change event of the Start field, place it in the Current event of the Form AND in the AfterUpdate event of the Start field. The current event will set the second field properly for new records and for existing records as they are displayed. The AfterUpdate event will reset the property for the second field whenever the first field is changed.
[This message has been edited by Pat Hartman (edited 10-17-2001).]