Basing a recordset on a query

bleakcabal

Registered User.
Local time
Today, 16:34
Joined
Mar 19, 2002
Messages
12
Hi, I have a problem with an access application. What I want to do is create a recordset and instead of doing what I am currently doing :

Code:
Dim rsProduits As New Recordset

stQuery = "SELECT * FROM Produits WHERE " & 
WHEREClause & " ORDER BY NoSousCategorie;"

rsProduits.Open stQuery, CurrentProject.Connection, 3, 3

I want to specify an existing query in the database as the source of the recordset. I have tried several methods myself including doing

Code:
rsProduits.Open QUERYNAME, CurrentProject.Connection, 3, 3, 2

and

Code:
rsProduits.Open QUERYNAME, CurrentProject.Connection, 3, 3, 1

Or just putting the query name instead of my string and all methods give me the following error : Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

The query I use returns rows in query source and just to be sure it works I have created a sample report which uses this query as it's source property and everything works fine.

Thanks in advance for any kind of help you may give and if you need any clarifications just ask.
 
Something like Me.Recordsource= ("MyQuery")
or just base the report on the query.
 
Unfortuntly the current use does not use a report. I am using the recordset to write to a text document HTML tags. Also when I try to set the query as the form as record source I get an error. The reason is that the query uses information from a a field on the form that is not set when the forms open. Tough I think I may have found an awnser while writing this post, I will try and either set the source property of the form when the button to generate the document or something like that. I will get back to this forum with the results.
 

Users who are viewing this thread

Back
Top Bottom