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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access assign DAO recordset

Status
Not open for further replies.

scheidel21

Technical User
Oct 1, 2004
4
US
Hey all I have searched the forums and the web and have come to find what I thought was a solution for my problem, but it only led to more problems which I researched further, to no avail, so here I am to ask all of you my question, and see if you can help.

I have an access 2000 database, in which I am attempting to read the primary key into an array dimensioned to the total number of records in that table. Next I take and compare the value ineach slot of the array searching for a match in a second table each time it finds a match it adds a number to a corresponding slot in another array. ie empid(x) emphrs(x) If anyone has a better idea let me know but now we come to the crux of my problem. After taking months to figure out how I was going to do what I amgoing to do as soon as I tried to add a recordset to recordset variable, using the dao method, I got a type mismatch error. I searched to solve this problem and tried various things like making sure the DAO module was loaded. tried sql instead of just loading a table nothing is working. anyone have an solution?

Thank you all
Sincerely,
Alex
 
Make sure Microsoft DAO 3.# Object Library is checked (in VBE - Tools | References), then epxlicitly declare all dao objects:

[tt]dim rs as dao.recordset
dim db as dao.database
dim qd as dao.querydef[/tt]

But couldn't your comparing be done more effective thru joining the tables in a query?

Roy-Vidar
 
It sounds like you've not set the reference to DAO. Go to Tools->References and put a tick next to Microsoft DAO 3.x.
You then need to explicitly dim your variables:
Code:
Dim rst as [b]DAO./b]Recordset
If this doesn't work, you should post your code here so we can look through it.
Also, what are you trying to achieve with this code? It sounds like it could be simplified using queries.

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
 
Thanks guys I'll check to make sure I have DAO 3.x checked (although anything I can do if it's not there? I don't think I saw that module) If I still have problems I'll post the code. And thanks for the thought of joining the tables, unfortunately I thought of how to do this, even with my trusty sql reference, I couldn't see a way to do exactly what I wanted to do.

Thanks

Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top