Type Mismatch error

B

Bill

In Access 2002, I'm getting a type mismatch error in the
following project:

I changed the 2nd variable declaration to ADO.Recordset
on a tip that was provided, but I'm still getting the
error. Does anyone have any advice.

Dim db As Database
Dim rst As Recordset
Dim strSQL As String

strSQL = " SELECT dbo_CREDITS_DETAIL.Full_Item,
dbo_CREDITS_DETAIL.Price, dbo_CREDITS_DETAIL.QTY" & _
" FROM dbo_CREDITS_DETAIL" & _
" WHERE (((dbo_CREDITS_DETAIL.TTNUM) = " & Me!
TTNUM & "))"

Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL, dbOpenSnapshot)

DoCmd.TransferText acExportDelim, ,
strSQL, "H:\Text_Files\test2.txt"
 
G

Graeme Richardson

Hi Bill, you should declare both DAO variables as such.
Dim db As DAO.Database
Dim rst AS DAO.Recorset

However, why are you using them at all?
The DoCmd.TransferText statement doesn't require these objects!
Try the code without DAO objects.

Also, ensure that Me!TTNUM is the correct datatype for the query. And, if
it's text, wrap it in quotes.

Hope this helps, Graeme.
 

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