473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Required field

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
6 2077
comteck
179 100+
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
32,556 Expert Mod 16PB
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
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
32,556 Expert Mod 16PB
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
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
comteck
179 100+
Sorry about that. I made a mistake. Do what NeoPa said.

comteck
Oct 26 '06 #7

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

Similar topics

5
by: Lorenzo Bolognini | last post by:
Hi all, i need to detect whether a field is required or not. I'm using this code for building a string to convert later to an array (by Split) of which each element matches the field index (ex....
1
by: Deborah V. Gardner | last post by:
I have a form frmViolations with a subform sfrmViolations. There is a one-to-many relationship between the two. On the subform I have a date field and a duration field. Both can be blank but if...
16
by: Georges Heinesch | last post by:
Hi. My form contains a control (cboFooBar), which has an underlying field with the "Required" property set to "Yes". Now, while filling out all the controls of the form, I have to fill out this...
5
by: Dave Brydon | last post by:
I'm checking for required fields, and using the code below, which I normally have no difficulties with; however, as a twist I decided to return the focus back to the specific field(s) in question...
2
by: bufbec1 | last post by:
I am pretty good with Access, but do not understand VBA. I have researched this topic and see only VBA answers, so I hope someone can help with my specific question. I have 2 fields for an...
3
by: Orchid | last post by:
Hello All, Hope someone can help me on my required field problems. I have a form base on a table for users to input new Employees. There are 4 fields that cannot be Null when entering new...
2
by: pmud | last post by:
Hi, I have an ASP.Net web page . The page was working fine until I added a required field field validator. My page has a link button which takes the user to another page, a submit button which...
3
by: CindyRob | last post by:
I am using .NET framework 1.1 SP1, .NET framework SDK 1.1 SP1, with hotfix 82202, Visual studio .NET 2003 with hotfix 823639. I have generated a proxy class using wsdl.exe from a schema that has an...
7
by: kiwipedia | last post by:
Hi all I have a combo-box control which I've set as a required field. It's a date and uses a calendar as coded below. All works fine unless the user deletes a pre-existing value (leaving a...
7
by: samdev | last post by:
I have set up a table with a few fields that are set to required....all work fine except the fields that are Lookup from another table. What am I forgetting to set? Thanks!!
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.