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

Enabling/ Disabling Combo Boxes

Hi All,

This message is a continuation of an earlier post, so please accept my
apologies as I believe I would get a better response this way.

Problem:

I have 4 combo boxes which I want to able to enable/ disable depending
on the selection made in the first combo.

Below I have the code I am using

Private Sub Lead_AfterUpDate()

Me.Purchase.Enabled = Not (Me.Lead = "Not Interested")
Me.Package.Enabled = Not (Me.Lead = "Not Interested")
Me.Users.Enabled = Not (Me.Lead = "Not Interested")
End Sub

This works fine, But I now need to add another option in the 'Lead'
combo box to do the same thing.

i.e.
the user can select "Not Interested" and 'Purchase', 'Package',
'Users' become disabled.

Now I need the user to select "Unavailable" and return the same
results. eg disable 'Purchase', 'Package', 'Users'.

kindest regards
Nov 13 '05 #1
5 1797
tom
Try This (warning: Air Code. Untested.:

Private Sub Lead_AfterUpDate()

On Error Resume Next

Dim EnableEm as Boolean
Dim LeadVal as String

LeadVal = nz(Me.Lead.Value, "")

EnableEm = Not ((LeadVal = "Not Interested") Or (LeadVal =
"Unavailable") Or (Leadval = ""))

Me.Purchase.Enabled = EnableEm
Me.Package.Enabled = EnableEm
Me.Users.Enabled = EnableEm
End Sub
le*@prologic.ie (Cillies) wrote in message news:<ba**************************@posting.google. com>...
Hi All,

This message is a continuation of an earlier post, so please accept my
apologies as I believe I would get a better response this way.

Problem:

I have 4 combo boxes which I want to able to enable/ disable depending
on the selection made in the first combo.

Below I have the code I am using

Private Sub Lead_AfterUpDate()

Me.Purchase.Enabled = Not (Me.Lead = "Not Interested")
Me.Package.Enabled = Not (Me.Lead = "Not Interested")
Me.Users.Enabled = Not (Me.Lead = "Not Interested")
End Sub

This works fine, But I now need to add another option in the 'Lead'
combo box to do the same thing.

i.e.
the user can select "Not Interested" and 'Purchase', 'Package',
'Users' become disabled.

Now I need the user to select "Unavailable" and return the same
results. eg disable 'Purchase', 'Package', 'Users'.

kindest regards

Nov 13 '05 #2
Have you tried a select case statement
(Air Code)

Private Sub Lead_AfterUpDate()
Dim strLead as String
strLead = Me.Lead
Select Case strLead
Case "Not Interested"
Me.Purchase.Enabled = True
Me.Package.Enabled = True
Me.Users.Enabled = True

Case "Unavailable"
Me.Purchase.Enabled = False
Me.Package.Enabled = False
Me.Users.Enabled = False
Case Else
Nov 13 '05 #3
Have you tried a select case statement
(Air Code)

Private Sub Lead_AfterUpDate()
Dim strLead as String
strLead = Me.Lead
Select Case strLead
Case "Not Interested"
Me.Purchase.Enabled = True
Me.Package.Enabled = True
Me.Users.Enabled = True

Case "Unavailable"
Me.Purchase.Enabled = False
Me.Package.Enabled = False
Me.Users.Enabled = False
Case Else
Nov 13 '05 #4
Thanks guys, It works a treat.

Tom, Your air code was spot on. Reggie I encountered some problems with
your select case statement, where it would disable the combos but not in
the way intended. after selecting options in the combo1 box twice, all
the combos would become enabled, but thanks very much for your time and
consideration with my problem, much appreciated.
kindest Regards


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5
Thanks guys, It works a treat.

Tom, Your air code was spot on. Reggie I encountered some problems with
your select case statement, where it would disable the combos but not in
the way intended. after selecting options in the combo1 box twice, all
the combos would become enabled, but thanks very much for your time and
consideration with my problem, much appreciated.
kindest Regards


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Krisa | last post by:
Hello all, I just discovered something (stop me if you've heard this before....) that was causing me a significant performance hit when opening a form with subforms. To speed up loading the...
2
by: HumptyDumpty | last post by:
Does anyone know if there is a problem with re-enabling the Screen Saver after it has been disabled programmatically. I am using the SystemParametersInfo function within User32.dll, and have...
7
by: John Meyer | last post by:
I have a program where I have to enable or disable a list box based upon a radio button. Is there an "enabled" property on select boxes?
0
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number...
4
by: Dave | last post by:
I wasn't sure how to search for previous posts about this, it felt real specific. Ok so here's the database & problem: I have 4 combo boxes: cboServer, cboPolicy, cboDB, and cboApplication. ...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
1
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
2
by: someshbakliwal | last post by:
Hi, I have created some autopopulating combo boxes on my HTML page (script- Javascript). so these combo boxes are autopopulated with choices made in previous combo boxes. The problem I am facing is...
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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,...
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.