473,657 Members | 2,515 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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]![CreateNewRecord Form]![PaidTo_combobox]))
ORDER BY [costcode].[Department], [costcode].[CodeDescription];

Paid_To_Combobo x 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 1587
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]![CreateNewRecord Form]![PaidTo_combobox]))
ORDER BY [costcode].[Department], [costcode].[CodeDescription];

Paid_To_Combobo x 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]![CreateNewRecord Form]![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_combo box only shows planning choices
else if PaidTo_combobox =Building Control then
CostCode1_combo box 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_combo box only shows planning choices
else if PaidTo_combobox =Building Control then
CostCode1_combo box 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.Re query

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_combo box only shows planning choices
else if PaidTo_combobox =Building Control then
CostCode1_combo box 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.Re query

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
8508
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 of doing it. I have a table with products, tblProducts, some of them are Active while others are Inactive. The form shows all the products purchased by a customer, both Active and Inactive in a ComboBox, cbProducts. My client wants to view all...
1
2312
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 collection, the .text property does not update. Furthermore, you can't easily trap an event to examine the new value if your program assigns it programmatically as opposed to someone typing it in and tabbing away from it. That is, TextChanged does...
5
7057
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 has no possibility to use a mouse !! How can I program a automatic dropDown ( Showing all entries ), if the user tabs to the comboBox ???
3
2852
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 the dropdown part enlarges outside the bounds of the panel. How can I achieve this for my own usercontrol? My usercontrol is a textbox with on it's right side a button and if you click the button a datagrid becomes visible below the textbox, but...
5
10286
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 trying to do is make an autoscroll combobox. like you have on html textbox's, but this time you hit enter for a change to be made. i do this because i dont want to requery every time a single letter is inputed. it would be too slow. so i make them hit...
4
2651
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 on what you select in the first drop down box, another dropdown box will be populated with specific info based upon what was selected in the first box. For example: The first drop down box has "Breakfast" "Lunch" and "Dinner" as a
2
5046
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 tabpage,it should show "The option from dropdown should be selected" and focus the combo .I have did this in validating event it works fine till focusing the combo.If I again try to select the combo which is focused,the dropdown of the combo is...
1
1182
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>". Then have the person use the dropdown to select the item. If only one item is found, then I show the item in the dropdown and load its values without a problem. Here is the code I use to populate the dropdown. How would I add the <Select Runitem...
2
3250
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, shift+tab , 44 dropdown menu opens OK. How to fix ? How to use VCSE 2008 with .net framework source code to find the line in
0
8413
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7352
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.