473,769 Members | 4,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Restricting combobox to Filtered Form

I have a form whose rowsource is a single table, i.e. 'Datasystem'.

I use a combobox to search for records in that table based on the
value of a single field, i.e., 'systemname'.

I use a multi-select listbox to filter the form on a different field,
i.e. 'domain', so that the filtered form can have several allowed values
of this field
I want to restrict my combobox to only the records in the filtered
form. I don't know how to write a query for its rowsource that will
use the selected values of the listbox to determine whether a record
is in the search space.

I'm sure I'm missing something obvious: things can't be as baroque as
I'm imagining them.

--thelma
Jan 10 '08 #1
3 2405
Salad <oi*@vinegar.co mwrote:
: Thelma Roslyn Lubkin wrote:

<snip>

:I want to restrict my combobox to only the records in the filtered
:form. I don't know how to write a query for its rowsource that will
:use the selected values of the listbox to determine whether a record
:is in the search space.

: The code below will come close to what you need if you change the
: listbox, combobox, and field names. Just because you select something
: to filter in the listbox, you need an event to put your code in to
: update the forms filter and combobox. That's where you'd call the code
: below.

<snipped the code>

Thank you very much.

I realized after I posted this that what I really wanted to say
is how do I write a query for the combo box based not on the
field in the table, but on the form's current record set.

I will try to implement this today.

--thelma

: West India
: http://www.youtube.com/watch?v=cl4_XNa7JKI
Jan 10 '08 #2
Thelma Roslyn Lubkin wrote:
Salad <oi*@vinegar.co mwrote:
: Thelma Roslyn Lubkin wrote:

<snip>

:I want to restrict my combobox to only the records in the filtered
:form. I don't know how to write a query for its rowsource that will
:use the selected values of the listbox to determine whether a record
:is in the search space.

: The code below will come close to what you need if you change the
: listbox, combobox, and field names. Just because you select something
: to filter in the listbox, you need an event to put your code in to
: update the forms filter and combobox. That's where you'd call the code
: below.

<snipped the code>

Thank you very much.

I realized after I posted this that what I really wanted to say
is how do I write a query for the combo box based not on the
field in the table, but on the form's current record set.

I will try to implement this today.

--thelma
If your combo can be associated with the filter, you could also try
something like
strSQL = "Select FieldName From TableName "
If Me.Filter "" then
strSQL = strSQL & "Where " & Me.Filter
'for testing
msgbox strSQL
Endif
Me.ComboName.Ro wSource = strSQL
>
: West India
: http://www.youtube.com/watch?v=cl4_XNa7JKI
Jan 10 '08 #3
Salad <oi*@vinegar.co mwrote:

: If your combo can be associated with the filter, you could also try
: something like
: strSQL = "Select FieldName From TableName "
: If Me.Filter "" then
: strSQL = strSQL & "Where " & Me.Filter
: 'for testing
: msgbox strSQL
: Endif
: Me.ComboName.Ro wSource = strSQL

*This* is that 'obvious' solution that I was looking for.
It works.
--thelma
:>
:: West India
:: http://www.youtube.com/watch?v=cl4_XNa7JKI
Jan 11 '08 #4

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

Similar topics

3
6673
by: jim | last post by:
Hi NG I have a form in which I use a combobox - the content of the combobox depend on the customername shown in a textbox. Now my problem is that I want the content in the combobox to change every time a record with a new customername is chosen. I have tried to put in a me.controls("combobox").requery in afterupdate event, and also a lot of other events, but it does not work.
8
12105
by: Zlatko Matiæ | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the combobox. What is the solution? Thank you in advance.
2
3166
by: Stu | last post by:
Hi, I've been working on trying to use a combo box to filter my records for a while now, and can't get it to work. Right now, I have SQL code written into IfThen statements on the afterupdate for the combobox. I tried using the docmd.runSQL but from looking at previous posts, it seems that I need to use DoCmd.OpenQuery instead since I do not have an action SQL statement. The short term problem is that when the user selects from the...
6
1786
by: Doug Bell | last post by:
Hi I have a datagrid with a combo box, I need to populate the combo with data dependant on the record value. eg for record 1, field Warehouse = 2R so combo would allow selection of locations valid for 2R record 2 has Warehouse = 2M so combo on that row has a selection of locations valid for 2M I can set the combo datasource but can't see how to set it on a row by row basis.
5
1534
by: TS | last post by:
This is getting very frustrating. I placed the same question before twice and got no response. Hopefully I'll get one this time. What I want to do is to restrict the items in one of the cbo boxes in my windows form based on what is selected in another cbo box. Example: When I choose "George" from the cbo box that shows the clients last names, I want when I click on the cbo box that shows the first names to see only the first names who have...
5
5916
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique CompanyID's. The second combobox will contain unique memberID's. Each of the tables that I have to search contain a CompanyID and a memberID field, and these fields are not unique in the respective tables. Like CompanyID, MemberID
4
5110
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I have to load 30,000 unique names into a combox. Filling a dataTable takes only a few milliseconds. But populating the combobox and displaying the list takes several seconds - way too long. A user selects a name from the combobox and runs a query. Originally, this combox was on a form in an MS Access ADP which was linked directly to our sql server. The combobox populated withins millisecnods. How can I achieve this...
2
2922
by: PTMech | last post by:
I have a tabbed subform (data sheet view) for which one of the controls is a combo box. It is based on a query that needs to be filtered by the same field data linking the main and sub forms. I get a parameter entry box which asks for the value and then retains that value when the parent form records are scrolled thru. I have created a specific query fort the combobox recordsource and have tried several modifications to the WHERE part of...
1
2506
by: viranadim | last post by:
I am having problems with attempting to filter a form based on criteria selected in a combo box from another form. I am attempting to filter a form called "Ford CheckList" that is based on a table called "Ford Returned Warranty Parts List". I am using the catagory "Program" that is in a combobox called "Program_Combo" which is located on a form called "Ford Database: Choose an Option". I want the user to open the form "Ford Database: Choose an...
0
9589
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
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
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...
1
9994
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
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
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();...
1
3959
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 we have to send another system
2
3562
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.