473,386 Members | 1,694 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.

Gray out combo box base on value list

Hello,

I just can't figure out how to grey out the combobox when value chosen is "closed". combobox is set to have a value list in the resource type and the resource is "Open", "Closed"

Expand|Select|Wrap|Line Numbers
  1. If Me.[Position_Status] = "Closed" Then
  2.     Me.[Position_Status].Enabled = False
  3.   Else
  4.     Me.[Position_Status].Enabled = True
  5. End If
  6.  
May 14 '18 #1
4 1189
NeoPa
32,556 Expert Mod 16PB
I would simplify the code :
Expand|Select|Wrap|Line Numbers
  1. With Me
  2.     .Position_Status.Enabled = (.Position_Status.Value <> "Closed")
  3. End With
Not forgetting that the code should be in both the form's Current event handler and the control's AfterUpdate event handler. Sensibly, it should be within a procedure that's called from within both event handlers.
May 14 '18 #2
Thank you NeoPa, but did not work...The one I submitted does it, but it does not stay gray out(Disabled), it just flash it and go back to showing the field with value enable again when I change to another record. Thank you for helping.
May 15 '18 #3
I was able to do it with a conditional formatting instead, it worked perfectly, thank you NeoPa

In Form Design View:
  • Right-Click on the Combobox
  • Click on Conditional Formatting
  • Under 'Condition1' select Expression Is
  • In the next box, enter [Position Status] = "Closed"
  • Now click on the 'Enabled' icon...the one on the far right (to turn the Enabled property off)
  • Click on OK
May 15 '18 #4
NeoPa
32,556 Expert Mod 16PB
IvonSurf:
Thank you NeoPa, but did not work...
If it didn't work then I don't understand what you want ... or you haven't correctly implemented the suggestion.

Bear in mind that enabling a Control is only necessary for the current record. If you're using continuous form view (which would be new to this dicussion) then you certainly won't see each record set correctly. However, you will find you can only make the changes at the appropriate points.

If you are working with continuous forms then Conditional Formatting is probably a better solution.
May 15 '18 #5

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

Similar topics

0
by: Alienz | last post by:
Hey, I was reading the google groups for info on this but the explanation left out exactly how to do the query.. Lets say I have table1 with 2 combo boxes combo1 has a value list of: "new",...
8
by: vpettes | last post by:
I am new to Access having used Filemaker for many years. My question has to do with displaying and creating a line item database. What I have is a two tables. One has Name, Location, time,...
3
by: anirban | last post by:
I am a novice of VB I want to fetch data from combo box or list which is selected give me a easy way to select the data of combo box or list box I can show data in combo box or list box
2
by: sideejay | last post by:
I added some items to my value list in a table but I noticed the value list in the form did not get updated. Why is that? I would have figured they would have a relationship. It is a music...
2
by: Otter7 | last post by:
Hello! I am a beginner with MS Access 2007. Creating a complex DB and need assistance on lookup columns created through Lookup Wizard with Allow Edits in table field. When a user enters a new value...
3
by: bknabl | last post by:
I tried setting up a new combo box to have todays date as a user choice by setting its property to a value list. Then for the row source it set it to =Date(). Access will not show what the expression...
1
by: Yousaf Shah | last post by:
Hello everybody Suppose we have two bound combo boxes, "PositiveGPE_Finding" and "Lymphnode_Gp" respectively, in form named "History". "PositiveGPE_Finding" combo box have value list with Multiple...
8
by: tmdrake | last post by:
My form has a value list that contains four (4) options. I only want two of the four to appear int the combo box on this specific form. And the other two to appear in the combo box of another form...
7
Seth Schrock
by: Seth Schrock | last post by:
Is there some known issue in Access 2013 where a combo box with a value list and two columns can't be bound? I tried it using the Row Source of "M";"Male";"F";"Female". When I set the Control...
4
by: irsmalik | last post by:
Hello friends y I need your help. I want to run a report through 3 selection. Company Region Territory All selection is made by Combo Box and List Box. When I select Company, it must display...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.