Solved

Combo Box Puzzle

Posted on 2011-03-24
1
287 Views
Last Modified: 2012-05-11
Hi,

I have a tricky problem to solve, which I’m a bit stuck on.

I have combo box which has numerical value within the first column. (cbo_1).

Under this I have 4 further combo boxes. (cbo_2 -> cbo_5)

The idea is that a user makes a choice from the cbo_1 control.  For this example say its 10. The 10 have to be assigned to any of the other 4 combo controls.

So far I have set the change event of cbo_1 to populate each of the 4 controls which the value of cbo_1

I use this code:

For i = 1 To Forms!fdlgInspection.cbo_1.Column(1)
  sRS = sRS & "," & CStr(i)
Next i

Forms!fdlgInspection.cbo_2.RowSource = Right(sRS, Len(sRS) - 1)
Forms!fdlgInspection.cbo_3.RowSource = Right(sRS, Len(sRS) - 1)
Forms!fdlgInspection.cbo_4.RowSource = Right(sRS, Len(sRS) - 1)
Forms!fdlgInspection.cbo_5.RowSource = Right(sRS, Len(sRS) - 1)

This is where I’m stuck.  If for example the user selects 4 from any of the above controls then I would like the remaining 3 to have the values reset so the maximum they can choose is 6.  Basically no matter what selection is made (in whichever order the grand total of the controls can never exceed the value held within Forms!fdlgInspection.cbo_1.Column(1).

Is this even achievable?  Any suggestions much appreciated.
0
Comment
Question by:andyw27
1 Comment
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 35208218
you can try this


Private Sub cbo_2_AfterUpdate()
sRS = ""
For i = 1 To Forms!fdlgInspection.cbo_1.Column(1) - Forms!fdlgInspection.cbo_2.Column(0)
  sRS = sRS & "," & CStr(i)
Next i
Forms!fdlgInspection.cbo_3.RowSource = Right(sRS, Len(sRS) - 1)
Forms!fdlgInspection.cbo_4.RowSource = Right(sRS, Len(sRS) - 1)
Forms!fdlgInspection.cbo_5.RowSource = Right(sRS, Len(sRS) - 1)

End Sub
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now