Getting an Runtime error 13 when defining a recordset, have I got the syntax wrong ?

A

acs68

Hi all,

I created a query using the Access Query Builder and pasted it into the
db.openrecordset as can be seen below. It doesn't seem to want to work and I
am getting a Run-time error '13': Type Mismatch. Any ideas as to what I am
doing wrong.

Set TextRS = db.openrecordset("SELECT RMTRANFUND.*, RMFUND.FUNDNAME FROM
RMTRANFUND LEFT JOIN RMFUND ON RMTRANFUND.FUND = RMFUND.FUND WHERE
(((RMTRANFUND.TRANKY)=269347));")

cheers,

Adam
 
A

Allen Browne

Above that line you have:
Dim TextRS As Recordset

The trouble is that multiple libraries have a Recordset object, and you are
being given the wrong one, hence the expected Type does not match.

To solve it, use:
Dim TextRS AS DAO.Recordset

More information on references and disambiguation:
http://members.iinet.net.au/~allenbrowne/ser-38.html
 

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

Top