Enable/Disable multipule text boxes based on any text in another textbox

M

Mesa

Hey guys, I have been stuck on this one for awhile. I have a textbox
labeled "College or University", and I want to be able to type any
value for it to enable 2 other textboxes labeled "Degree" and "Field of
Study". How can I code this so that I can just type anything in the
"College or University" textbox and it enables the other two and also
if nothing is typed it will stay disabled. Your help is VERY
appreciated!!!


Private Sub Form_Current()
Select Case Me![College or University] = "??????????"
Case True
Me![Degree].Enabled = True
Me![Field of Study].Enabled = True
Case False
Me![Degree].Enabled = False
Me![Field of Study].Enabled = False
End Select
End Sub
_________________________________________________

Private Sub College_or_University_Change()
Select Case Me![College or University] = "??????????"
Case True
Me![Degree].Enabled = True
Me![Field of Study].Enabled = True
Case False
Me![Degree].Enabled = False
Me![Field of Study].Enabled = False
End Select
End Sub
 
J

Jeff Boyce

It sounds like you are saying "if the length of what is in [College or
University] is greater than 0, enable [Degree] and [Field of Study], and if
0 (?or Null), disable those two. If this is accurate, try something like
the following in the AfterUpdate event of [College or University] (your
syntax may vary):

Dim blnEnabled as Boolean
blnEnabled = Len(Nz([College or University],"")>0
Me![Degree].Enabled = blnEnabled
Me![Field of Study].Enabled = blnEnabled

Another way to do that would be to add a value to the Tag property of the
two fields and use that fact to set .Enabled on them after an update to the
first.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 
M

Mesa

Thankyou for the reply, what you are saying makes alot of sense but i
cannot get the Len function to work. This gave me insight on how i can
view this problem.I really appreciate the reply.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top