Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    sstiebinger is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2015
    Posts
    105
    Quote Originally Posted by ssanfu View Post
    The first thing I would change is to add these two lines at the top of EVERY code module:
    Code:
    Option Compare Database
    Option Explicit
    If you go to the IDE/Tools/OPTIONS, on the "Editor" tab, check the option "Require Variable Declaration". This will automatically add "Option Explicit" to NEW modules created.
    - Done



    I've also added some basic error handling in each of the affected subs to start narrowing down the root cause (haven't yet had time to actually re-create the forms.)
    Basically, I'm not actually resolving any errors, but I'm raising them at the point of entry so I know where they are, e.g.:
    Code:
    Private Sub ViewOpportunity()
        On Error GoTo ViewOppErr:
        Dim strLinkCriteria As String
        strLinkCriteria = "[OpportunityID]=" & Me![OpportunityID]
        DoCmd.OpenForm "frmOpportunityDetail", , , strLinkCriteria
        Forms.frmOpportunityDetail.AllowAdditions = False
    ViewOppErr:
        If Err.Number <> 0 Then
            MsgBox "Error in form sfrmOpportunityList in function ViewOpportunity()" & vbCrLf & Err.Description, vbCritical, "ERROR!"
            Resume Next
        End If
    End Sub
    I've got error code similar to that in every function on each form that's currently involved and once I've got this immediate problem solved, I'll go through my code and add SOME sort of error handler to every function in every module.

    At this point, I'm getting an error thrown specifically in that ViewOpportunity() function, with no err.description at all, the form then opens (the resume next kicks in.)
    So I've clearly still got some fine tuning to do on the error handling to determine exactly what is causing the issue.

  2. #17
    sstiebinger is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2015
    Posts
    105
    Ahh, actually I forgot the "exit sub" in front of the error label.

    So now, the forms work without throwing an error at all...

  3. #18
    sstiebinger is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2015
    Posts
    105
    Ok, well the problem has mysteriously resolved itself (maybe the corruption was fixed in one of the compact and repairs I did...)
    While I'm happy that the system is working, I'm unhappy that there's no clear resolution and I'm worried this issue may recur.

    I clearly have a project ahead of me to insert error handling code throughout the project.

    Thank you everyone for the assistance.

  4. #19
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    I clearly have a project ahead of me to insert error handling code throughout the project.
    Get yourself a free copy of MZ Tools to make light work of this. I wouldn't be without it.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #20
    sstiebinger is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2015
    Posts
    105
    Thanks Bob, that toolkit certainly looks useful.
    It's not, however, free. (There is a 30 day trial...)

    I'll look into whether or not this is worth the investment.

    I appreciate the tip for new productivity tools though!

  6. #21
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    My apologies. It would appear that you are right and that it is no longer free.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 12-15-2015, 04:01 PM
  2. Replies: 1
    Last Post: 07-18-2015, 08:02 AM
  3. Replies: 1
    Last Post: 11-14-2014, 05:12 PM
  4. Replies: 6
    Last Post: 10-15-2014, 02:45 PM
  5. Replies: 4
    Last Post: 11-26-2013, 02:35 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