|
-
Sep 10th, 2002, 02:24 AM
#1
Thread Starter
Addicted Member
Filter by table *resolved*
I have 2 tables, tblIssues and tblTypes
I want to filter the recordset a couple times by each record in tblTypes. For example,
tblIssues has 4 columns,
ID, p_id, summary and type_id
tblTypes has 2 columns
type_id, type
tblTypes looks something like
1 Dates
2 Modifications
3 Request
4 Telemarketing
each issue would be one of these types. I want to display all the issues in 4 separate tables, one for each type.
Currently my recordset contains all the records. I know i can filter using the rs.Filter, but how can i loop it so that it filters and displays by each type in tblTypes?
i know this sounds kind of confusing but I don't know how to explain it better.
thanks.
Last edited by Feetstink; Sep 10th, 2002 at 04:01 AM.
-
Sep 10th, 2002, 02:53 AM
#2
Re: Filter by table
Originally posted by Feetstink
I have 2 tables, tblIssues and tblTypes
I want to filter the recordset a couple times by each record in tblTypes. For example,
tblIssues has 4 columns
ID, p_id, summary, type_id
tblTypes has 2 columns
type_id, type
VB Code:
strSql="Select tblIssues.*, tblTypes.[Type] from tblIssues Left Join tblTypes On tblIssues.Type_id=tblTypes.Type_id"
'strSql=strSql & " Where tblIssues.Type_id = " & cboTypes
strsql=strSql & " Order By tblIssues.Type_id;"
That will order them, you can loop through if you wish...
I wouldn't separate them though, since in theory you could add more types and you'd then need to code and create a list box for each.
Another way would be to filter the list by type using a combo box above the list box (just put the remarked line back in). This gives the users the ability to see all or just one type.
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Sep 10th, 2002, 03:21 AM
#3
Thread Starter
Addicted Member
Re: Re: Filter by table
I'm sorry, i'm still kind of new to this part of everything. I'm using this on an asp page, so I don't have a combo box or listbox or anything.
I was hoping i could do something like
for each typeName in tblTypes
rs.Filter = "type = "& typeName
' code to print all the records in a table
loop
that way, no matter how many types i have in tblTypes, it will print that many tables.
is this a little more clear?
-
Sep 10th, 2002, 03:42 AM
#4
Do the order by bit loop through and hold the type id in a variable.
If on the next pass the type changes create a new table otherwise add to the current table.
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Sep 10th, 2002, 04:00 AM
#5
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|