Results 1 to 4 of 4
  1. #1
    Sonu is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Aug 2019
    Posts
    35

    MS Access 2016 Form Button Click - Run Time Error

    Hello Guys,




    I am facing an awkward run time error in a MS Access 2016 Form. I have a Form with a button. On clicking the button, it is expected to perform some processes (written in VBA code behind). But as soon as the button is clicked, VBA code starts to execute and an error message pops-out (with just a number and no error description).


    By looking at the VBA code, I could track that the code starts to execute, and directly goes to the error handling section. Below is the top portion of the code:


    ################################################## ######


    Private Sub cmdCA_Click()


    Dim strMsg As String
    Dim intIcon As Integer
    Dim strTitle As String
    Dim strCriteria As String
    Dim strAddr As String
    Dim strDoc As String
    Dim strMSS As String
    Dim db As DAO.Database
    Dim rstEmail As DAO.Recordset
    Dim rstStatus As DAO.Recordset
    Const conAction As Long = 20

    On Error GoTo Err_cmdCA_Click


    .........
    Other code here
    .........


    Exit_cmdCA_Click:
    Exit Sub

    Err_cmdCA_Click:
    MsgBox "Error " & Err.Number & ": " & Err.Description, vbExclamation, _
    "frmCorrectiveAction cmdCA_Click"
    Resume Exit_cmdCA_Click


    End Sub


    ################################################## ######


    Any help will be appreciated. I can provide any additional details, if required.


    Thank You.
    Attached Thumbnails Attached Thumbnails MS Access 2016 Form Button Error.png  

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Show us the line of code that causes the error
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Disable error handler and see what happens. Hopefully, that will give a more informative error message from Access and debugger stop on line causing issue.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  4. #4
    Sonu is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Aug 2019
    Posts
    35
    Sorry, I was quick to post the question. Later I did some debugging myself and found the problem. It was related to some of the MS word Templates (.dot) created long ago and the new MS Office version was probably not able to open/read them in the VBA code. I saved them as .docx and it worked.

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

Similar Threads

  1. Replies: 2
    Last Post: 03-25-2019, 12:59 AM
  2. Replies: 2
    Last Post: 01-08-2019, 12:56 PM
  3. Replies: 6
    Last Post: 02-04-2018, 09:39 AM
  4. Replies: 3
    Last Post: 03-17-2017, 08:00 AM
  5. Replies: 9
    Last Post: 09-25-2014, 11:34 AM

Tags for this Thread

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