Type Mismatch in Recordset sql


Carrie L.

Frustrated! What have I done wrong, when I try to run the following code, it
gets to the set rst line and gives me a type mismatch...

Sub runstuff()
Dim dbs As Database
Dim rst As Recordset
Dim strsql As String
Dim dept, mgrid As String
Dim ckpopu1 As Integer
Dim firstd As Date
Set dbs = CurrentDb
strsql = "Select [Current Departments].* from [Current Departments]"
Set rst = dbs.OpenRecordset(strsql)



Jeff Boyce


You don't mention which version of Access. At one point, Microsoft changed
the default model from DAO to (?hmm?) ADO.

See what happens if you change your DIM statements to something like:

Dim dbs As DAO.Database
Dim rst As DAO.Recordset

Good luck!


Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question