Results 1 to 8 of 8
  1. #1
    VicM is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    20

    StartApp() function in AutoExec not found

    Hi folks,

    I have a head scratcher here.



    I'm using Access 2010 on a Win7 box. The DBs are in the accdb format.

    One DB uses the AutoExec macro to display a form on opening. Works just fine.

    In another DB, I wanted to add a form to appear upon opening. So I created the AutoExec macro similar to the working DB. The only difference was the form name I wanted to open. But when I open this DB I get an error saying it can't find the StartApp() function. All the references are identical in the two DBs.

    This attachment is a zipped docx file showing the two AutoExec macros; one that fails and one that works.
    AutoExecError.zip

    Any help is greatly appreciated.

    Vic

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,616
    Couldn't you just embed images in post instead of making us unzip a file?

    Why is form in quote marks in code that fails but not in quote marks in code that works?

    Instead of AutoExec could set a form to open by default and function called by that form.

    What does StartApp() function do?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,385
    Normally, my Autoexec macro just runs a startup function period. The startup function does all the rest, like opening the form.
    The argument in the runcode should be
    Function Name =startapp0()
    including the "="

  4. #4
    VicM is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    20
    June7
    I had just wanted to upload the docx file. But when I tried, the system said I had to zip it. I put the form name in quotes because there was a space in the name. And it doesn't address the fact that the macro works in one DB and not the other. It's producing the error at the StartApp() function. Never gets to the form name. Even if I remove the quotes from the form name.


    davegri
    It doesn't matter whether I have an = sign in the code or not. Still produces the error. And I preferred the old format for macros where you had to code it yourself. I'm not a fan of the pre-formatted version where you just fill in blanks. What I will say is that the WorkingDB was originally in mdb format and over time I upgraded it to accdb. The BooksRead DB started out already in accdb format. Could that be a reason?

    Thanks to both of you for responding.

  5. #5
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,385
    It's unclear what your approach is for the macro. If all you want to do is open a form, you don't need the runcode at all. Just open the form.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,616
    I don't use macros (with one exception of AutoKeys macro). Maybe conversion from mdb to accdb did cause issue. Weirdness is often corruption that can't be fixed except by rebuilding.

    Did you try deleting and rebuilding macro?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    VicM is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    20
    Well I decided to remove theRunCode statement and just went with the OpenForm statement. That worked. But it's still confusing and weird that the WorkingDB works with the RunCode statement.
    Thanks everyone for your input.

  8. #8
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    2,385
    The working db is doing something other than just opening the form. It is first running a function in a code module to do some task. After that, it opens the form. Your non-working DB was trying to run the function also, but that function does not exist in that DB. That's why you got the error telling you the function could not be found. Removing the call to the function fixed the problem as you discovered.
    Last edited by davegri; 07-04-2020 at 07:45 PM. Reason: sp

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

Similar Threads

  1. autoexec to execute function at startup not working
    By bbxrider in forum Programming
    Replies: 10
    Last Post: 01-12-2019, 05:50 PM
  2. Function not found errors
    By melmaule in forum Access
    Replies: 4
    Last Post: 12-12-2016, 10:53 AM
  3. Replies: 2
    Last Post: 08-19-2013, 01:14 PM
  4. Access AutoExec Macro Cannot Find Function
    By JuanTooTree in forum Access
    Replies: 3
    Last Post: 03-14-2013, 08:52 AM
  5. Replies: 3
    Last Post: 01-08-2013, 11:51 AM

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 - Senior Forums