Access 2010, I am trying to disable "Give back" if I select it from the combobox, but is not working now, before it was because I was using a List, but I am using a query now, any help will be appreciate it -
-
-
If Me.LeavingGroupProfile.RowSource = "SELECT tbl_LeavingGroupProfile.LeavingGroupID, tbl_LeavingGroupProfile.LeavingGroupName " & _
-
"FROM tbl_LeavingGroupProfile " & _
-
"WHERE (((tbl_LeavingGroupProfile.LeavingGroupName) = 'Give Back' " & _
-
"ORDER BY tbl_LeavingGroupProfile.LeavingGroupName; " Then
-
Me.Reason_for_Leaving.Enabled = False
-
Else
-
Me.Reason_for_Leaving.Enabled = True
-
End If
-
-
See Post #2 above.
A streamlined version is below: - Private Sub LeavingGroupProfile_AfterUpdate()
-
-
Me.Reason_for_Leaving.Enabled = Not (Me.LeavingGroupProfile.Value = "Give Back")
-
-
End Sub
Again, unless we are missing something, this is as straightforward as can be. Please clarify.
10 4381
ivonsurf,
I'm a little bit fuzzy on when you're trying to make the disable/enable happen and which object you are trying to do it to. Your code indicates Reason_for_Leaving is the field you want disabled/enabled, so I'm operating off that assumption. If you simply want to disable the field when a user selects "Give Back" from the combo box, the code below should do what you need. If, however, you are trying to have it disable when "Give Back" is even an option to select, that would be another matter. -
Private Sub LeavingGroupProfile_AfterUpdate()
-
-
If Me.LeavingGroupProfile.Value = "Give Back" Then
-
Me.Reason_for_Leaving.Enabled = False
-
Else
-
Me.Reason_for_Leaving.Enabled = True
-
End If
-
-
End Sub
-
Hello,
That's the thing it does not work, before worked because the Give back was withing a list of options as a List in that combobox, but now is not longer a list, it is a source: query/Table, when I select Give back it does not go gray out anymore.
twinnyfo 3,653
Recognized Expert Moderator Specialist
ivonsurf123,
Like gnawoncents, I, too, am a bit confused as to what it is that you are trying to disable. If your code sets the Row Source based on a selection from a Combo Box, then there is really no reason to check the value of the Row Source--simply refer to the Combo Box itself, as recommended.
Are we missing some important details about what you are trying to do and how you are trying to do it?
I create a table call LeavingGroupProfile, I have a form named Position Fills, in that form I have a combo box with a items to select, one of them is "Give back", now the way I bring that list into the combo box is through a Table/Query Row Source type, what I want to do now is in that combo box from the Position fill form, every time that I select "Give Back" another combobox named Reason for Leaving, also with a list coming from a Table/Query Row source Type to go gray out as soon as I select "Give Back" from Leaving Group Combobox in the Position Fills form.
twinnyfo 3,653
Recognized Expert Moderator Specialist
See Post #2 above.
A streamlined version is below: - Private Sub LeavingGroupProfile_AfterUpdate()
-
-
Me.Reason_for_Leaving.Enabled = Not (Me.LeavingGroupProfile.Value = "Give Back")
-
-
End Sub
Again, unless we are missing something, this is as straightforward as can be. Please clarify.
Thank you twinnyfo, It works perfectly!
To the best of my knowledge it is not possible to simply create a coloured row Combo Box, but I vaguely remember downloading a sample DB some years ago. I will see if I can find it when I get onto my main computer tomorrow.
Phil
twinnyfo 3,653
Recognized Expert Moderator Specialist
Technically, speaking, Phil's initial response should be set to "Best Answer." I merely clarified/streamlined his response.
Phil, concerning the colored row combo box, I wonder if it is possible to create a subform that mimics a combo box? But, so as not to hijack this post, that would be another thread/article....
twinnyfo,
Thanks for posting the streamlined example. I've never considered constructing a line that way, but it is cleaner and makes perfect sense. Good stuff!
twinnyfo 3,653
Recognized Expert Moderator Specialist
gnawoncents,
I can't take any credit for that one. It's a little trick taught me by NeoPa. Since I've learned it, it has been incredibly useful in countless ways.
So glad I could hepp!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dmanhr |
last post by:
Hi,
I'm developing a control (derived from ComboBox) with permanent items
(First, Previous, Next, Last). So, I'd like it's collection of items couldn't
be changed neither in design time nor...
|
by: tottigang |
last post by:
Hi,
I have a tabstrip and I have some tabs in it. On the first page, all
the tabs are enabled, I need to disbale part of the tabs at a specific
point in the application and again enable them. I...
|
by: MervinJadhav |
last post by:
How to disable combo items?
Mervin Jadhav
Software Developer
Solutiioneyes Pvt Ltd (http://www.solutiioneyes.com)
203, Sai Chambers, 16 Mumbai-Pune Rd, Pune - 411 003 INDIA
|
by: Patrick Flaherty |
last post by:
Hi,
Experienced programmer but new to PHP. Moreover I'm to use PHP with Xoops on
top (this adds object orientation?).
I don't seem to find a xoops Usenet group?
Whatever the case (and...
|
by: FaWiizio |
last post by:
Is it possible to add an item to a combobox this way:
ComboBox1.Items.Add("Cool!")
AND assign to this new Item a unique index ?
As in HTML
<option value="1">Cool</option>
|
by: Rick Shaw |
last post by:
Hi. I've struggling with the combobox databinding in C#. What I was trying
to do was:
- Hard code the items in the combobox's Items (collection) property. (ie.
'Mon', 'Tue', 'Wed', 'Thu',...
|
by: active |
last post by:
I need a combobox where the items are typed as string - not object.
And another where the items are from a class I generated.
Can one make such comboboxes from System.Windows.Forms.ComboBox?...
|
by: sharperrr |
last post by:
Access2000
Hi I have a combobox which displays a list of values dependent on another field.
On the fields onchange event the rowsource of the combobox changes according to the value in the...
|
by: Claudia Fong |
last post by:
Hi,
I added a tabcontrol in a panel in my form.
My tabcontrol have more than 3 pages.. each page contains textboxes,
combobox, checkbox.
I want to disable the items of each of the page of...
|
by: =?Utf-8?B?RHJEQkY=?= |
last post by:
I understand that the Value put into a DataGridViewComboBoxCell has to be a
member of the Items list or an exception is thrown.
I also understand that you can override that exception by handling...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |