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

Another data field validation question

P: 26
Thanks everybody here answered my last data field validation question about the alert of future date.

Here I get another question, sorry, I am really an Access newbie...

The question is :

I have a couple of list fields, one of the field will pop up only based on the upper list field value is true, for example, list field "individual_session" and list field "nationality", the nationality field will pop up and ready to choose the value only when individual_sesion value is true, otherwise the nationality field shows gray (the individual_session value is false, the list field nationality isn't enabled).

Thanks million
Sep 30 '08 #1
Share this Question
Share on Google+
12 Replies


P: 26
some mistake here, there are combo box for individual_session and nationality rather than list field.

I am online waiting , anybody can help?
Sep 30 '08 #2

P: 26
why nobody helped me today, i didn't explain the question very clear?

My supervisor didn't give me a lot of time to work on it, and I also tried many ways, but still didn't walk through...

Experts, please help....
Sep 30 '08 #3

P: 26
the question right now can like this:


I have a couple of combo box fields, one of the field will pop up only based on the upper field value is "true", for example, field "individual_session" and field "nationality", the nationality field will pop up and ready to choose the value only when individual_sesion value is "true", otherwise the field nationality will be forced to fill blank.


Thanks million
Sep 30 '08 #4

beacon
100+
P: 579
the question right now can like this:


I have a couple of combo box fields, one of the field will pop up only based on the upper field value is "true", for example, field "individual_session" and field "nationality", the nationality field will pop up and ready to choose the value only when individual_sesion value is "true", otherwise the field nationality will be forced to fill blank.


Thanks million
Hi JJP,

These combo box fields are on a form, correct? Are you saying that when the user enters something into the "individual_session" that the "nationality" field becomes enabled?

If that's the case, then one of the combo boxes should be set to enabled, while the other will be set to disabled. Then you can enter VBA code to test whether or not the first combo box has a value in it and, depending on the answer, can code the second field to be enabled.

For instance:
Expand|Select|Wrap|Line Numbers
  1. If Not IsNull(Me.Individual_Session) then
  2.      Me.Nationality.Enabled = True
  3. End If
  4.  
You might even want to put something into the OnLoad event for the form to ensure that the Nationality field is disabled to start off with each time.

I hope this helps...
Sep 30 '08 #5

P: 26
Thank you very much, yes, it is a form with some combo box, both individual_session and nationality are combo boxes, where individual_session can select value " true" or "false", and for nationality, the data source is from table nationailty, so there are lists of nationality to be chozen. But only when the user select individual_session is "True", then nationality is avaible to be selected from a drop down list...
Sep 30 '08 #6

beacon
100+
P: 579
Ok, then the following code...
Expand|Select|Wrap|Line Numbers
  1. If Not IsNull(Me.Individual_Session) Then
  2.      Me.Nationality.Enabled = True
  3. End If
  4.  
...needs to change to the following
Expand|Select|Wrap|Line Numbers
  1. If Me.Individual_Session.Value = "True" Then
  2.      Me.Nationality.Enabled = True
  3. End If
  4.  
Sep 30 '08 #7

P: 26
Ok, then the following code...

...needs to change to the following
Expand|Select|Wrap|Line Numbers
  1. If Me.Individual_Session.Value = "True" Then
  2.      Me.Nationality.Enabled = True
  3. End If
  4.  

but It gave me compile error:


method or data member not found and Me.Nationality.Enabled = True where "Enable" was highlighted
Sep 30 '08 #8

beacon
100+
P: 579
What event are you using?

I created a combobox (Box1) and went chose the event procedure for OnChange.

The code ends up looking like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Box1_Change()
  2.      if me.box1.value = "True" then
  3.           me.box2.enabled = True
  4.      else
  5.           me.box2.enabled = False
  6.      end if
  7. End Sub
  8.  
This assumes that you've already set your Box1's 'Enabled' property to 'No' and that in the form's Load event you've typed in something like the following:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.      me.box2.enabled = False
  3. End Sub
  4.  
Sep 30 '08 #9

P: 26
What event are you using?

I created a combobox (Box1) and went chose the event procedure for OnChange.

The code ends up looking like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Box1_Change()
  2.      if me.box1.value = "True" then
  3.           me.box2.enabled = True
  4.      else
  5.           me.box2.enabled = False
  6.      end if
  7. End Sub
  8.  
This assumes that you've already set your Box1's 'Enabled' property to 'No' and that in the form's Load event you've typed in something like the following:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.      me.box2.enabled = False
  3. End Sub
  4.  

Thanks beacon, it showed me something I wanted...
bow!
Sep 30 '08 #10

P: 26
Still gave me compile error message,
right now I set box2 nationality enable=no
and select box1 individual_session "false" from drop down menu, box2 is gray as expected, but when I select box1 individual_session "True", didn't enable the box2 as expected but gave me the compile error.
the code here is:

Private Sub s1_individual_session_Change()
If Me.s1_individual_session.Value = "True" Then
Me.s1_nationality1.Enabled = True

End If
End Sub

Me.s1_nationality1.Enabled = True where Enabled is highlighted
Sep 30 '08 #11

beacon
100+
P: 579
Does the individual_session pull the true/false values that populate the combobox from a table?

On the table, are the true/false values entered as a text string or is the field set up as a yes/no field?
Sep 30 '08 #12

P: 26
Does the individual_session pull the true/false values that populate the combobox from a table?

On the table, are the true/false values entered as a text string or is the field set up as a yes/no field?

On the form the combo box individual_session pulls the true/false values from the value list rather than from a table, but the underlying the table, I set individual_session as text type, but on the form I set individual_session as combo box that contains list value "True" and "False"

Thank you
Oct 1 '08 #13

Post your reply

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