Type Mismatch

S

ScottA

I am trying to create a recordset which can later be
exported to Word as a table. This recordset includes
details of documents distributed to a list of recipients.

The button I'm using for launching the code is attached to
the recipient form (the Me here in the code) - I want to
create a recordset that includes details for only those
documents that have been sent to the recipient displayed.

When I try to run the code, I am getting a Type Mismatch
error at the point when the recordset should be created.

Can anyone tell me what I might be doing wrong?

Thanks,

Scott A

Here's the code:
==========================================================
Private Sub cmdWord_Click()
On Error GoTo Err_cmdWord_Click

Dim db As Database
Dim recDocList As Recordset
Dim strSQL As String
Dim strDocs As String

Set db = CurrentDb()

strSQL = "SELECT * FROM qryDistDetail " & _
"WHERE (((tblDistributions.RecipientID) = " & Me!
RecipientID & "))"

Set recDocList = db.OpenRecordset(strSQL)

strDocs = "Title" & vbTab & "Doc No." & vbTab
& "Version" & vbCr
While Not recDocList.EOF
strDocs = strDocs & vbCrLf & recDocList
("DocTitle") & vbTab & _
recDocList("DocCode") & vbTab & _
recDocList("DocVersion")
recDocList.MoveNext
Wend

CreateDocAOR recDocList

recDocList.Close



Exit_cmdWord_Click:
Exit Sub

Err_cmdWord_Click:
MsgBox Err.Description
Resume Exit_cmdWord_Click

End Sub
 
A

Alex Dybenko

try to declare recordset as:
Dim recDocList As DAO.Recordset

probably you have also reference to adodb, so you have to explicity specify
which one you want to open
 
S

ScottA

I've tried declaring the recordset as DAO.Recordset, and
that still didn't work, so I tried declaring the db as
DAO.Database, and am still getting the type mismatch error.

Any other troublespots I should look for?

Scott
 
S

ScottA

But works when I change the priority of the DAO library...

Thanks for the tip!

Scott A
 

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

Similar Threads


Top