looping through recordset based on query

Help.Chris

Registered User.
Local time
Today, 08:00
Joined
Oct 11, 2000
Messages
43
Hi everyone,

I need to loop through the values in a query to create a new complex sql statement off it. (Merging three crosstab queries)

The query has a maximum of 16 records, so I have to join the three crosstab queries together for each of the individial records.
The new sql statement I can do, already done with multiselect list box.

I now need to use the same theory, and loop through each record in my query called "Top 16 Destinations", and use a field from it called "Destination_Code".

I am using 2000, but I am using the ado and dao libraries.

Does anyone know the code to succesfuly loop through each record, evertime I have tried, I have had the error message to few parameters on the open recordset statement.

Any contribution would be greatly apreciated.

Chris
 
Further Information-

The exact error message is "To few parameters. expected to", this is an error no 3061.

It occurs on the line

Set rs = db.OpenRecordset("Top 16 Destinations", dbOpenDynaset)

I am pretty stumped, so any help would be greatly appreciated.

Thanks

Chris
 
I had something similar happen to me. I think you are on the right track with References.

Try it again, but only with:

Microsoft DAO 3.6 Object Library
Visual Basic for Applications
Microsoft Access 9.0 Object Library

May not fix it, but I know I had a real interference from the Active X library a couple of days ago.

You may also want to try to declare the db as a DAO.Database so Access knows where to pick it's reference from.

I still do not understand References good enough.

Sorry if it doesn't work, It did for my problem.

Dave Mack
Saratoga, NY Where Racing Season is is Full Swing!
 
Do a search for "too few parameters" on this forum and you'll see the answers Pat Hartman and others have posted giving you info on the source and solution.

The problem is not caused by references, it is caused because you need to explicitly set parameters used in a recordset query.(Too few parameters,expected <<the number of criteria you have>>

The answer is definitely on the forum and has been answered recently so I won't repeat the answer.

Ian
 

Users who are viewing this thread

Back
Top Bottom