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

Customised Dropdown ComboBox

Hi all,

I have 2 ComboBoxes

The first has 3 choices

Planning
Building Control
Planning & Building Control

The second combobox should display criteria from a table based upon
what the user selects from the first box.
In the table there are Department, CodeDescription, Code.

I can get the second combobox to display all the values in this table
called costcode. But i want it only to display the relevant items.

I have sort of got this working by using
SELECT [costcode].[code], [costcode].[CodeDescription],
[costcode].[Department] FROM costcode WHERE
((([costcode].[Department])=[Forms]![CreateNewRecordForm]![PaidTo_combobox]))
ORDER BY [costcode].[Department], [costcode].[CodeDescription];

Paid_To_Combobox being my first combobox.

What happens when i do this is that it works for planning or building
control but when it is both i want to display both however the table
only has codes for planning and codes for building control. And also if
i change the first box i want the second box to catch up with the
changes.

Can anyone help.
Please let me know if you require any more info.

Nov 13 '05 #1
4 1575
si************@gmail.com wrote:
Hi all,

I have 2 ComboBoxes

The first has 3 choices

Planning
Building Control
Planning & Building Control

The second combobox should display criteria from a table based upon
what the user selects from the first box.
In the table there are Department, CodeDescription, Code.

I can get the second combobox to display all the values in this table
called costcode. But i want it only to display the relevant items.

I have sort of got this working by using
SELECT [costcode].[code], [costcode].[CodeDescription],
[costcode].[Department] FROM costcode WHERE
((([costcode].[Department])=[Forms]![CreateNewRecordForm]![PaidTo_combobox]))
ORDER BY [costcode].[Department], [costcode].[CodeDescription];

Paid_To_Combobox being my first combobox.

What happens when i do this is that it works for planning or building
control but when it is both i want to display both however the table
only has codes for planning and codes for building control. And also if
i change the first box i want the second box to catch up with the
changes.

Can anyone help.
Please let me know if you require any more info.


In your combo rowsource (query), add a column
Expr1:[Forms]![CreateNewRecordForm]![PaidTo_combobox] = "Planning &
Building Control"

In the second row of criteria, enter
True

This creates an Or condition. It will either match the combobox
selection or it's for all conditions.
Nov 13 '05 #2
Hi i tried that and noting worked.
Basically i want to be able to say

If PaidTo_combobox=Planning then
CostCode1_combobox only shows planning choices
else if PaidTo_combobox=Building Control then
CostCode1_combobox only shows Building Control choices
else (if its Planning & Building Control)
Show both choices

Can i do something like this in my query.
Please help

Nov 13 '05 #3
si************@gmail.com wrote:
Hi i tried that and noting worked.
Basically i want to be able to say

If PaidTo_combobox=Planning then
CostCode1_combobox only shows planning choices
else if PaidTo_combobox=Building Control then
CostCode1_combobox only shows Building Control choices
else (if its Planning & Building Control)
Show both choices

Can i do something like this in my query.
Please help

Did you requery the combo after the selection of Planning or Building oi
Both is selected? Ex:
Me.CostCode1.Requery

If it still doesn't work, debug. Copy the SQL from the comboPaidTo into
a query (Query/New/Design/Close/ViewSQL then Paste. Now open up the
form and select something. Click Window and select the database window
and open up your query and run. You should be able to determine why you
error out.

BTW, is your list a value list...ex Planning, or is it a 2 column combo
like 1;Planning? If so, you need to change the Expr1 to equal the value
, not the text.
Nov 13 '05 #4
si************@gmail.com wrote:
Hi i tried that and noting worked.
Basically i want to be able to say

If PaidTo_combobox=Planning then
CostCode1_combobox only shows planning choices
else if PaidTo_combobox=Building Control then
CostCode1_combobox only shows Building Control choices
else (if its Planning & Building Control)
Show both choices

Can i do something like this in my query.
Please help

Did you requery the combo after the selection of Planning or Building oi
Both is selected? Ex:
Me.CostCode1.Requery

If it still doesn't work, debug. Copy the SQL from the comboPaidTo into
a query (Query/New/Design/Close/ViewSQL then Paste. Now open up the
form and select something. Click Window and select the database window
and open up your query and run. You should be able to determine why you
error out.

BTW, is your list a value list...ex Planning, or is it a 2 column combo
like 1;Planning? If so, you need to change the Expr1 to equal the value
, not the text.
Nov 13 '05 #5

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

Similar topics

7
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
1
by: Norm Katz | last post by:
When you use a bound combobox and you set its dropdown style to "dropdown" that allows you to enter text in the edit box. But if you enter anything other than a value in the current bound items...
5
by: Peter Stojkovic | last post by:
VB 7.1 and windows.forms. I have a comboBox on a form. When the user goes with TAB-Key to the comboBox, the comboBox should dropDown the ListBox automatically and show ALL entries. The user...
3
by: Peter Proost | last post by:
Hi I have made my own control with a dropdown functionality like a combobox and it works just great, but I've got one problem remaining. If you put a combobox on a panel and press the little arrow...
5
by: Gil | last post by:
Is there a way to tell if a combbox is in dropdown mode. I tried and if statement combobox.dropdown = true but i get an error. dropwndown function doesnt store if its true or false what i am...
4
by: AccessRookie | last post by:
Ok, I am pretty new to Access (Using Access 2002 at my job). Here is what I want to do. I want to create a database that has a form. On this form will be a dropdown menu (combobox). Depending...
2
by: Vidhura | last post by:
My application contains 2 tabpages.The second tabpage contains panel .The panel contains series of combobox and textboxes. If the item not selected in combobox and the user click on the another...
1
by: John Wright | last post by:
I have a dropdown that I load a list of values from a database. If I have more that one value returned from a search I want to populate the dropdown and have the first value be "<Select Run>". ...
2
by: Andrus | last post by:
SWF DataGridView contains combobox control. Activating combobox and pressing F4 to open dropdown menu causes strange NRE (see below). When I enter some valid value to combobox, press tab,...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.