Transferspreadsheet acExport produces Error 3011

  • Thread starter ragtopcaddy via AccessMonster.com
  • Start date
R

ragtopcaddy via AccessMonster.com

My Transferspreadsheet acExport line produces Error 3011, "The microsoft Jet
database engine could not find the object, 'qryLeaseEventStores'".

Here's the line:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qryLeaseEventStores", strRptPath, True

When I run the query, it runs just fine. However, it contains 2 references in
a subquery to the following function in a different module:

Public Function MonthLastDay(ByVal dCurrDate As Date)
Dim dFirstDayNextMonth As Date

On Error GoTo lbl_Error

MonthLastDay = Empty
dFirstDayNextMonth = DateSerial(CInt(Format(dCurrDate, "yyyy")), CInt
(Format(dCurrDate, "mm")) + 1, 1)
MonthLastDay = DateAdd("d", -1, dFirstDayNextMonth)

Exit Function
lbl_Error:
MsgBox Err.Description, vbOKOnly + vbExclamation
End Function

If I try to run the query while the code is running, I get an "Unknown Jet
Error" twice. I'm assuming its' not a coincidence that I have 2 instances of
the function in a couple of subqueries in qryLeaseEventStores.

When I step through the code that does the transferspreadsheet, it steps
through the function twice, as well.

Any ideas would be appreciated.

Thanks
 

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