Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to append multiple recordsets together

Status
Not open for further replies.

quellyn

Programmer
Aug 1, 2001
3
US
Hi from VB's newest newbie:

I am trying to develop an app that lets users store and review news articles related to the electric power industry. I allow the user to select from three list boxes (multiple selections are allowed for each list box) to specify the type of the article, the region it pertains to and the utility company affected.

I then copy the selected items over into three arrays. What I then need to do is to run an SQL query on all combinations of the selected entries, and show the user the resulting database records:

'Open an empty recordset
Set rstArticles = dbsArticles.OpenRecordset("")
rstArticles.BOF

'Loop over all elements in all three arrays
For Each articleType In arrArticleType
For Each region In arrRegions
For Each utility In arrUtilities

'WHERE portion of SQL query
strWhereSQL = "WHERE (((ArticleType.ArticleTypeDescription) = '" _
& articleType & "') " & "OR ((Regions.Region) = '" & region & "') " _
& "OR ((Utilities.Utility) = '" & utility & "')) "

'??Need to append rstTemp to rstArticles somehow
strSQL = strSelectSQL & strFromSQL & strWhereSQL
Set rstTemp = dbsArticles.OpenRecordset(strSQL)
...

Does anyone know how I can append my resulting recordsets to a "master" recordset? Or better yet, can someone tell me if there is a better way to do this?

This is my first-ever post, so I hope it's legible:)

Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top