Results 1 to 4 of 4
  1. #1
    JuanTooTree is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    2

    Access AutoExec Macro Cannot Find Function

    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.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    21,849
    You've covered the usual suspects. Did you include the parentheses in the macro?


    fRunMatchQuery()

    If so, can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    JuanTooTree is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    2
    D'oh! I missed off the parenthesis.

    Thanks for your help Paul.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    21,849
    Happy to help! Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-08-2013, 11:51 AM
  2. Replies: 7
    Last Post: 06-14-2012, 01:54 PM
  3. Help Stopping AutoExec Macro
    By drewetzel in forum Access
    Replies: 2
    Last Post: 10-03-2011, 10:51 AM
  4. Replies: 2
    Last Post: 06-20-2011, 09:20 AM
  5. Using parameter in autoexec macro
    By lchurch in forum Queries
    Replies: 0
    Last Post: 03-04-2009, 06:22 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums