Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the Check box Enabled when Text Box not Null

Status
Not open for further replies.

Steven547

Technical User
Sep 15, 2004
165
US
I have a form with 3 date field (text boxes). Plus, I have a check box. The date fields are located on a tab control (which shouldn't matter because it's on the same form)

What I'm looking to do, is when ONE of the date fields is filled, the check box becomes enabled. If the date field has a value in it already, but the user decides to delete it, then the check box should be DISABLED.

The Check box is set to Enabled = False as default.

When I tried code on the lost focus even of the date fields, it would work, but when I clicked somewhere else on the form, it became disabled again. It could be it's Monday and my mind is still on the weekend, but I can't figure this out.

Any suggestions?
 
Use the on current event.

Dim blnEmpty as boolean

blnEmpty = true

If me.txt1 <> "" or is not null(me.txt1)
blnEmpty = False
End If
If me.txt2 <> "" or is not null(me.txt2)
blnEmpty = False
End If

If blnEmpty = false then
me.chk1.enables = true
Else
me.chk1.enables = false
End If


Tyrone Lumley
SoCalAccessPro
 
Code:
Function CheckThreeTextBoxesForDate()

Me.CheckboxName.enabled =(isdate(me.DateTextBox1) or isdate(me.DateTextBox2) or isdate(me.DateTextBox3))

end Function

Run This Function After Update Of the Textboxes and on Current
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top