Results 1 to 5 of 5
  1. #1
    Phred is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    246

    Error logging tables Front end Access 7 back end SQL Server 2008 R2


    When developing in Access 7 as Front End and Access as back end, I am able to locate the sys tables that are created when the database encounters an error. They are useful when debugging.

    My current development is Access 2007 front end with Linked Tables from SQL Server 2008 R2. When I bring tables in with the Linked Tables manager, I do not link anything but the tables I am developing. There are a myriad of other tables in SQL Server.

    Is there an equivalent table in SQL Server I should bring in to log errors that occur? This is my first SQL Server development.

    Thanks,

    Phred

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Once you link the SQL table there shouldnt be any errors. What are you trying to find?

  3. #3
    Phred is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    246
    Hi ranman:

    I place error handlers in all of my modules. The database has not even reached Alpha Test, it is still in development. For example when testing a long chunk of code I generated an null error. It would be nice if it generated a error in a table to assist me tracking it down. It will probably come in handy when it goes into Alpha testing. This was very helpful when another database, months in production, with an Access Front End and Access Back End generated an error on importing data. With the error table I was able to track it down easily. But, like I said, this is my first time using SQL Server.

    Thanks, Phred

    I just realized my first example with Null is poor. I was able to track that down quickly in a long chunk of code by disabling the error handler and clicking Debug on the warning screen. Forget that. The second example is better.
    Last edited by Phred; 04-14-2015 at 10:52 AM. Reason: Bad example

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    I cant help with the SQL error idea, but since you are running in Access, ALL errors will be in the Access front end.
    No need to record them since they happen live. The message box error will stop at the point you need and debug will lead you to the culprit. This is how I've always tracked errors.
    NOW, if you want to get fancy, in your error code, right before the Msgbox err.description, put a Routine to write the error to a log table. I use this.

    usage: POST2LOG (err.description,"MyRoutine()",err)

    Code:
    Public Sub Post2Log(pvEvent, pvSrc, pvError)
    Dim sSql As String
    Dim vElaps, vUser
    
    
    vUser = Environ("Username")
    
    sSql = "INSERT INTO tLogs ([Event], [Tbl], [EventDate],[USER]) values ('"  & pvEvent  & "','" &  pvSrc & "','" & pvError & "','" & vUser & "',#" & Now() & "#)"
    
    HrGlass
    DoCmd.RunSQL sSql
    End Sub

  5. #5
    Phred is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    246
    That's a great idea. I didn't realize you could do that. It would solve the problem completely. I usually place a user friendly message box that tells them in nice words that something has happened and a second cryptic technical message will appear and just to click yes and it will be logged. If I ran this piece of code just after the technical error message I would capture everything in a really nice way. I need to play around with this as I haven't used anything like it before. Thanks, and I may come back with a few questions. I've never used public subs before. I need to look a few things up. Thanks so much. Phred

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

Similar Threads

  1. Replies: 4
    Last Post: 11-22-2013, 11:20 AM
  2. Replies: 4
    Last Post: 11-29-2012, 12:45 AM
  3. Replies: 1
    Last Post: 11-16-2012, 10:25 AM
  4. Replies: 3
    Last Post: 05-17-2012, 05:41 AM
  5. Replies: 7
    Last Post: 05-15-2010, 10:12 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