Query help needed

bluenose76

Registered User.
Local time
Today, 12:44
Joined
Nov 28, 2004
Messages
127
Gentlemen,

I am having a little trouble with what seems to be a complicated query.

My problem is that I have a table that has a column with 23 unique entries. And a column with 6 entries.

When I run my query I need it to first filter by the column with the 6 entries and then subsequently select several choice from the column with 23 in it.

The Column with 6 entries is populated with alpha characters and the column with 23 is numeric.


I have tried many variations of query and this does not give me the result I wish. The next stage I believe is some VB Code, however my working knowledge of VB code is not good enough to write this myself.

Any and all advice / suggestions is 100% appreciated.

Thank you
Bev
 
More information needed...
My problem is that I have a table that has a column with 23 unique entries. And a column with 6 entries.
But, every cell (in every record) in those two columns is populated with a value, right? Or are there NULLS in some of those cells?
When I run my query I need it to first filter by the column with the 6 entries and then subsequently select several choice from the column with 23 in it.
How do you want to filter it? Specific values or user-defined?
 
I was curious to know if i had explained myself correctly or not? and the answer is that i obviously did not.

my table has many column that all contain data however i wish to run a query that is based upon two of them.

The first criteria will just select one entry from colum one, however i need to select multiple entries from column two.

The choice of criteria that i wish to select from both columns will change each time i run the query so i need to be prompted for what it is that i require to see each time i run it.

I can do a simple query that will populate based upon column one, or populate based upon what i want from column two, however i cannot get it to include both at the same time. the only way i have managed to achieve this in any way was to have one query to seach the criteria on colum one and then a seperate to search on column two.

this is unacceptable for what i require so need to be able to select the criteria needed each time i run the query.

any help is appreciated.

Regards
Bev
 
my table has many column that all contain data however i wish to run a query that is based upon two of them.

The first criteria will just select one entry from colum one, however i need to select multiple entries from column two.
This statement tells me that you might want to use Lister's Multi-Select listbox method to specify the second columns criteria. I wonder if you can use this?

This is exactly what I thought of when I read your post:

Use a combo box for the first column choice, the use a cascaded listbox (dependent on the combo box) to list the choices available for the second column.

Then, use a function to return a value that consists of all the selected listbox values in one long delimited string. Last, put the function's result in the criteria of the query
:
Code:
WHERE [fieldOne] = combobox AND [fieldTwo] LIKE "*" & MyFunction() & "*"
The general syntax that I got from lister, to get selected values from a listbox, is this (modified to fit the situation here):
Code:
Function GetSelected() as String

For intRow = 0 To c.ListCount - 1

GetSelected = ""

    If c.Selected(intRow) Then
      value = c.Column(0, intRow)

      if GetSelected = "" then
        GetSelected = value
      else
        GetSelected = GetSelected & "," & value 
      end if
      
    End If
  
  Next intRow
 
Last edited:

Users who are viewing this thread

Back
Top Bottom