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

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 2392
Salad <oi*@vinegar.comwrote:
: 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.comwrote:
: 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.RowSource = strSQL
>
: West India
: http://www.youtube.com/watch?v=cl4_XNa7JKI
Jan 10 '08 #3
Salad <oi*@vinegar.comwrote:

: 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.RowSource = 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
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...
8
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...
2
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...
6
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...
5
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...
5
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...
4
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...
2
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...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.