Hi, I have had a look round here, and the net in general, and this question has been asked a lot, but the answers don't solve my problem.
I've set up an AutoExec macro in Access 2010 to call a function (RunCode) called fRunMatchQuery, but it can't find it. I get the message "Microsoft Access cannot find the name 'fRunMatchQuery' you entered in the expression.
Here is the function:
Code:
Public Function fRunMatchQuery()
Dim datToday As Date
Dim strDate As String
datToday = Date
strDate = Format(datToday, "ddmmyy")
DoCmd.SetWarnings False
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryMatch", _
"V:\Data\ProductCode+FeatureCodes " & strDate & ".xlsx", True
Call sMatch
DoCmd.SetWarnings True
End Function
The function fRunMatchQuery is in a module called Module1, so it's not the same name issue which seems to be the most common cause of problems. And Module1 is a standard module created by right-clicking and inserting a new module, so it's not that the module is part of a form etc.
The function works fine when I step through the VBA.
I have the following VBA References set up (I'm not sure if they make any difference to this anyway):
Visual Basic for Applications
Microsoft Access 14.0 Object Library
OLE Automation
Microsoft Office 14.0 Access database engine Object Library
Microsoft Excel 14.0 Object Library
Does anyone have any idea what I'm doing wrong?
Thanks in advance for any help you can provide.