Results 1 to 10 of 10
  1. #1
    mreniff is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    41

    HELP HELP ASAP: COMPILE ERROR fExecuteQuery DISAPPEARED


    A function I have been using for weeks has disappeared! I do not wait to clutter this request with too much information.

    Initial analysis shows that the fExecuteQuery module has disappeared so I insert a new module and now I am getting a compile error.

    I need help to fix this. I have several backup copies of the database, but I really do not want to have to go back several iterations that do not have critical changes made recently.

    Click image for larger version. 

Name:	compile error missing module.JPG 
Views:	18 
Size:	76.1 KB 
ID:	41845

    The Database that has been behaving strangely and crashing frequently. Would this be the reason the module has disappeared?

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    You're not showing a function here at all.

    Try
    Currentdb.execute strSQL, dbfailonerror
    This syntax is free standing and requires no function.

    If you have a function named fExecuteQuery, it cannot have the same name as any module.

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    just run:
    docmd.runSql strSql

  4. #4
    mreniff is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    41
    Quote Originally Posted by davegri View Post
    You're not showing a function here at all.

    Try
    Currentdb.execute strSQL, dbfailonerror
    This syntax is free standing and requires no function.

    If you have a function named fExecuteQuery, it cannot have the same name as any module.
    Thank you .... I removed the fExecuteQuery module and imported the original code file. It appears to be working on my first try.

    Wish me luck

  5. #5
    mreniff is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    41

    Imported original code module: Working on first try

    Quote Originally Posted by ranman256 View Post
    just run:
    docmd.runSql strSql

    I removed the incorrectly name module and imported the original code.... so far it appears to be working.

    Wish me luck

  6. #6
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    OK. Good luck.

  7. #7
    mreniff is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    41

    learning opportunity.... why did model disappear

    Can anyone tell me why a module would disappear? How do prevent this from happening again?

    The database had been frequently crashing and creating a back up. The module was there after each crash because the function was working.

  8. #8
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Can't remember a module disappearing, but certainly have had code edits disappear. This has always been my fault for not saving in VBE. Another bad habit is editing code while the yellow error line is highlighted. Always RUN>RESET before editing code, then immediately save/debug/compile.

  9. #9
    mreniff is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    41

    Aha! sounds familiar

    Quote Originally Posted by davegri View Post
    Can't remember a module disappearing, but certainly have had code edits disappear. This has always been my fault for not saving in VBE. Another bad habit is editing code while the yellow error line is highlighted. Always RUN>RESET before editing code, then immediately save/debug/compile.

    This scenario sounds familiar. Its a bad habit I need to break.

  10. #10
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    can also happen if editing code whilst in form layout view and you don't save

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

Similar Threads

  1. Replies: 16
    Last Post: 06-03-2014, 10:22 PM
  2. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  3. Replies: 2
    Last Post: 06-23-2012, 11:59 PM
  4. Replies: 7
    Last Post: 06-08-2012, 09:55 PM
  5. Replies: 6
    Last Post: 09-28-2011, 09:20 PM

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