Results 1 to 10 of 10
  1. #1
    SeniorCitizen is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    32

    Problem with Buttons

    I have a form that I use for navigation with a button for each task. When I select any button I get the following error message. The form has been working well until I added a new button.

    The expression you entered on click as the event property setting produced the following error: A problem occurred while 'mt database' was communicating with the OL Server or Active X control.


    1 The expression may not result in the name of a macro , The name of a user defined function or Event Procedure.
    2 There may have been an error evaluating the function, event or macro

    For testing purposes the procedure on click is merely a msgbox

    No indication what to do about it.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,952
    Post your code or provide database for analysis.
    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
    SeniorCitizen is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    32
    Private Sub BtnIndividual_Click()
    'Me.LstNames.Visible = True
    'Me.BowlersID.Visible = True
    MsgBox "Hi"

    End Sub
    This is the code of the new button.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,952
    Don't see anything wrong with that.

    Possible corruption. Try deleting button and code and recreating.
    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.

  5. #5
    SeniorCitizen is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    32
    I Have tried that with no success. This is just the new button but all buttons yield the same message

  6. #6
    Edgar is online now Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    It could also indicate incomplete code within a module or class. Keep in mind that not all errors are accurately reported, so it's important to thoroughly check all your modules. There might be a typo in a variable declaration, subroutine definition, or a missing control. I once encountered a similar situation when the name of my initial form had changed. Access was expecting "FormX," but I had renamed it to "Main," resulting in the error message without any specific indication of the problem's location. Therefore, consider reviewing the places where the form name or the click event is referenced, such as macros or other options, that may not be present in any module or class.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,952
    At this point, suggest provide db for analysis. Follow instructions at bottom of my post.
    Last edited by June7; 07-04-2023 at 10:05 AM.
    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.

  8. #8
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,119
    Try to recreate the form and delete the old one:
    https://stackoverflow.com/questions/...g-with-the-ole

    I found the easiest is to start with an new empty form in design view, set any necessary properties such as back color, background picture, etc. for the form sections (header, detail and footer) then select all controls in each of the section in the original form and do a copy and paste. Once done copy the entire form module in the VBE window to the new form (usually this works without you having to manually reattach each procedure to the corresponding control), save it with a new name, delete the old one, rename it with the original name and run a compile and repair.

    Or you can also try to import all your objects into a brand new Access file, making sure you adjust the VBA references to fit your project.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  9. #9
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    perhaps you are missing a library reference?

  10. #10
    SeniorCitizen is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    32
    Thanks guys for the suggestions. I recreated the entire form with cut and paste and all is well. The problem is gone.

    Thanks

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

Similar Threads

  1. Radio Buttons Problem
    By luckydead in forum Access
    Replies: 11
    Last Post: 06-02-2021, 07:05 AM
  2. Replies: 2
    Last Post: 04-22-2017, 04:31 PM
  3. Replies: 1
    Last Post: 08-15-2013, 08:12 PM
  4. Replies: 3
    Last Post: 05-22-2013, 06:24 PM
  5. Replies: 10
    Last Post: 09-18-2012, 02:00 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