473,327 Members | 1,952 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,327 software developers and data experts.

Enabling and disabling fields based on value of combo box.

16
Hi,
I am working on a single form. I have two combo box named as-
1) CAST and 2) CATEGORY
Combo box CAST has options like - Brahmin, Jat, Gurjar, Bunkar etc.
And Combo box CATEGORY has option like - GEN, OBC, ST, SC etc.
I want to write a vba code in after update event for combo box CAST, so if I choose option like Jat or Gurjar, the Combo box CATEGORY should be enabled. And, if I choose option like Bunkar or Brahmin, the Combo box CATEGORY should be disabled.
Please help.
Jul 23 '18 #1
4 1023
twinnyfo
3,653 Expert Mod 2GB
Expand|Select|Wrap|Line Numbers
  1. Me.CATEGORY.Enabled = ((Me.CAST = "jat") _
  2.                     OR (Me.CAST = "Gurjar"))
Hope this hepps!
Jul 23 '18 #2
PhilOfWalton
1,430 Expert 1GB
Sorry, but that's not very elegant, Twinny.

Add a Yes/No field the the Cast Table and enable or disable the CATEGORY Combo depending on the value of that field.

That way you are not limited to the number of casts

Phil
Jul 23 '18 #3
NeoPa
32,556 Expert Mod 16PB
While Twinny's answer is a correct and direct answer to the question as posed, I have to agree with Phil that his suggestion is more flexible and continues to work well even when the requirements change slightly. His solution does have that element of elegance ;-)
Jul 23 '18 #4
twinnyfo
3,653 Expert Mod 2GB
Elegance: yes; flexibility: not quite so much.

:-)

Indeed, Phil has a better solution.
Jul 23 '18 #5

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

Similar topics

6
by: ML.Steve | last post by:
Hi, There are lots of posts on this subject but after a couple of hours of going though them I still can't get a number of fields to be disabled when a checkbox is ticked. Basically I have a...
0
by: Gian Paolo Clarici | last post by:
I'm migrating one Asp page to Aspx. There is a recordset and I need to Reponse.write the content of one of its fields . That field comes from a Numeric(5,2) SQL datatype Its content is : 90.00 ...
1
by: andy | last post by:
I have three things, 1. a form with a combo box on it. 2. A lookup table with 2 fields, RMName and RMmrm. 3. A table with site information including an RM field and an MRM field. The combo box...
14
by: TerdFerguson | last post by:
Hi everybody! I'm a total newbie at access, just opened it for the first time yesterday so bear with me. I tried a search for my answer and found similar topics but couldn't find the exact answer....
3
by: plaguna | last post by:
I'm trying to Count data in a Query Combining two different fields based on the "Date" the product was sold, and for some reason I get a wrong data. When I use only this expression, It works fine:...
2
by: rywags11 | last post by:
Hello, Can anyone help me figure out how to show/hide fields based on information entered in other fields in a form in Access 2007? What I'm looking to do is: When a selection from a drop down is...
3
by: Miranda Truehill | last post by:
I'm very new to programming and although I've seen a similar post that addressed this in part, I am unsure how exactly to go about this. I know I can utilize the DateAdd function but don't know...
20
by: Daniel Yantis | last post by:
Combo Box 1 Displays a query/list with 2 columns: SELECT Classes.CLASS_DESC, Judges.Judge, * FROM Classes; Combo Box 2 Displays a query/list: SELECT Judges.Judge FROM Judges; I want...
16
by: mehdi483 | last post by:
Hi! I'm a beginner user of mssql and I've been stuck in a report that I'm trying to make. I have a table with fields like 'PartName', 'VoucherQuantity', 'VoucherType', 'VoucherDate', and 'DLName'. I...
0
by: mahmoudwahbeh | last post by:
Dears I am trying to do a small program on VB 6.0 to find the records in database and print it in text box based on combo box selection but i failed to find a code which allow me to do this. ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.