Results 1 to 5 of 5
  1. #1
    oleander is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2017
    Posts
    16

    Error when clicking on form

    Hi everyone!



    I have a form with a bunch of different buttons on it. The buttons run reports or queries and all of them work fine. However, when I click on an empty space on the form itself, I get the following message:

    "The expression On Click you entered as the event propery setting produced the following error: Return without GoSub."

    When I go to the form's property sheet, there's nothing entered into "On Click". There's actually nothing listed anywhere on the Event tab except for Timer Interval: 0 and Key Preview: No.

    Any ideas why I'm getting this message?

    Thanks!

  2. #2
    oleander is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2017
    Posts
    16
    Actually, it looks like in the Detail portion of the form (the part where I'm clicking) there is something listed in On Click. It's as follows:

    Option Compare Database

    Private Sub cmdPOP_Click()

    End Sub

    Private Sub Command19_Click()

    End Sub

    Private Sub Command23_Click()

    End Sub

    Private Sub Detail_Click()

    End Sub


    I'm not sure what any of this means...

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Those are VBA subs that don't have any actual code in them. I wouldn't expect that error, but you can delete everything there except the top line. As a rule, Option Explicit should be added to the top line:

    http://www.baldyweb.com/OptionExplicit.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    You can get rid of the module that holds the form's VBA code, which is a good idea because it sound like it's corrupted and holds meaningless code stubs.
    In the form design FORM properties sheet, click the 'other' tab and set 'has module' to NO.
    Then do a compact/repair and see if the problem is fixed.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    The error can have several causes - controls that were deleted, trusted location issues, corruption (Auto Name Correct), subforms that have Load events that reference the main form are a few I've read about. Suggest you either open the vb editor and compile the project or do so with a command line switch.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Clicking outside the form
    By George in forum Modules
    Replies: 5
    Last Post: 04-23-2016, 08:13 PM
  2. Replies: 2
    Last Post: 09-15-2015, 03:08 AM
  3. Replies: 3
    Last Post: 03-24-2015, 04:42 AM
  4. Replies: 3
    Last Post: 10-30-2013, 05:59 AM
  5. Replies: 5
    Last Post: 11-11-2011, 11:06 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