Results 1 to 4 of 4
  1. #1
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486

    Expression On Click has error

    I have been getting an error in my database when a user clicks on a button that has an on click event. I am using DoCmd.OpenReport and the code works fine. However, sometimes I get the following error

    Click image for larger version. 

Name:	OnClick.PNG 
Views:	14 
Size:	38.4 KB 
ID:	25275

    If i go into design mode, then open the vba editor and then close it --WITH NO EDITS OR CHANGES-- then the buttons start to work.

    I have tried to compact and repair but when I open the database back up i get the same issue.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Sometimes. It gives a false error. This could be a code error NOT in the click event.
    something in the form is an error. These can be tough to find.
    try compiling, or looking for a control that has a property set, that doesn't work.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Also, be sure that the top 2 lines of EVERY code module are
    Code:
    Option Compare Database
    Option Explicit

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    Create another button to do the same thing and delete the current one. Sounds silly but sometimes I found that works.

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

Similar Threads

  1. Expression on click error
    By CHEECO in forum Access
    Replies: 6
    Last Post: 04-19-2016, 06:30 AM
  2. Expression On Click Error within a Form
    By johnson8809 in forum Access
    Replies: 1
    Last Post: 02-09-2015, 01:53 PM
  3. Replies: 11
    Last Post: 03-31-2014, 03:15 AM
  4. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  5. Replies: 1
    Last Post: 05-11-2012, 10:59 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