By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,558 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,558 IT Pros & Developers. It's quick & easy.

Required field

P: 22
Hello..

I know this has been asked before but i was hoping someone could help me with the codes to have one text or combo box be mandatory to get access to other fields in the form...all others maybe grayed out... until that one box is filled in.

Any suggestions?
Oct 25 '06 #1
Share this Question
Share on Google+
6 Replies


100+
P: 179
Try this. First, set the "Enabled" property to "No" for all textboxes, comboboxes, etc that you want greyed out. Then for the OnExit property for the textbox that you want the others to be dependant on, create an Event Procedure with the following code:

If Me.textbox1 <>"" Then
Me.textbox2.enabled="Yes"
Me.textbox3.enabled="Yes"
Me.combobox2.enabled="Yes"

'and so on

End If

Hope this helps.
comteck
Oct 25 '06 #2

NeoPa
Expert Mod 15k+
P: 31,441
In the AfterUpdate subroutine for the controlling TextBox put in code which says
Expand|Select|Wrap|Line Numbers
  1. If {condition met} Then
  2.     Object1.Enabled = True
  3.     Object2.Enabled = True
  4. Else
  5.     Object1.Enabled = False
  6.     Object2.Enabled = False
  7. End If
Otherwise, what I normally do (a bit more cryptic)
Expand|Select|Wrap|Line Numbers
  1. Object1.Enabled = {condition}
  2. Object2.Enabled = {condition}
Oct 25 '06 #3

P: 22
In the AfterUpdate subroutine for the controlling TextBox put in code which says
Expand|Select|Wrap|Line Numbers
  1. If {condition met} Then
  2.     Object1.Enabled = True
  3.     Object2.Enabled = True
  4. Else
  5.     Object1.Enabled = False
  6.     Object2.Enabled = False
  7. End If
Otherwise, what I normally do (a bit more cryptic)
Expand|Select|Wrap|Line Numbers
  1. Object1.Enabled = {condition}
  2. Object2.Enabled = {condition}

Condition being

If Me.POC <> "" Then (from post above???)

The text box does not let me enter any data and all boxes are enable still...i think i need help with the condition....
Oct 25 '06 #4

NeoPa
Expert Mod 15k+
P: 31,441
Is this what you're after?

Expand|Select|Wrap|Line Numbers
  1. Object1.Enabled = (Me.POC > "")
  2. Object2.Enabled = (Me.POC > "")
Oct 25 '06 #5

P: 22
Is this what you're after?

Expand|Select|Wrap|Line Numbers
  1. Object1.Enabled = (Me.POC > "")
  2. Object2.Enabled = (Me.POC > "")

Thanks...I think its working now!
Oct 25 '06 #6

100+
P: 179
Sorry about that. I made a mistake. Do what NeoPa said.

comteck
Oct 26 '06 #7

Post your reply

Sign in to post your reply or Sign up for a free account.