Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2007
    Location
    Big City
    Posts
    62

    Unanswered: Tracing Access Code

    Hello,
    My daily app that uploads and update data is not working prop as it was before.
    Is there are a way to trace access code and log it to the errorlog.txt file?
    Thank you for your help!

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Not quite sure what you mean.

    You can trace Access VBA line by line or by setting breakpoints etc, but something tells me this isn't what you want to do.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    If you're having problems with tracing updating of certain fields in Access tables via a query, you may find this a tad difficult to do but reading your question is difficult to diagnose without more info on how you import/update data. It's easier to track updated fields if you were opening recordsets and looping through the records. Access does create an error log table on importing bad data fields it can't interpret. SQL Server tables give you a lot more options on seeing what data was updated.

    If you give us more info on how you're updating the fields, it would be easier to diagnose and make suggestions.
    Last edited by pkstormy; 01-12-08 at 01:19.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Apr 2007
    Location
    Big City
    Posts
    62
    Sorry,
    I have a function DailyTasks, in which i have some subroutins
    call import text
    call append data
    call update
    is there a way to send a message to a log file or email me after each subroutin is done???

    thank you so much.

  5. #5
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    It sounds to me like you are trying to do what I did before. Do you want to know what line is causing and error and how the user got to that line of code (callstack)?

    If so, here is a link to the web page that helped me create my error logging.

    http://www.fmsinc.com/tpapers/vbacode/Debug.asp

    It is near the bottom, under Advanced Error Handling. The short description is... You add code to each procedure that pushes and pops the name of the procedure to an array. Then when you get an error, you call the Global Error Handler. This code evaluates the array and here is where you put code to write or display the callstack (all of the procedures that were called before the error).

    Let me know if this is what you were after. I can give more details if necessary. Once you get into the habit of including the lines in each procedure it is not a big deal, but it can be boring to retro-fit an existing application (like I did the first time I started using it).

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    Public Function logSomething(logText As String)
    
    Const forAppending As Integer = 8
    
    Dim fs As Object
    Dim a As Object
    
        Set fs = CreateObject("Scripting.FileSystemObject")
        Set a = fs.OpenTextFile("C:\logFile.txt", forAppending, True)
        a.writeline logText
        
        a.Close
        
        Set a = Nothing
        Set fs = Nothing
    
    End Function
    ??
    George
    Home | Blog

  7. #7
    Join Date
    Apr 2007
    Location
    Big City
    Posts
    62
    Thank you for all the help,
    The application wasn't written by me, I'm just a user, who likes to investigate the issues. We currently have no one in house who can provide adequate help in visual basic, so i'm trying my best to find solution, since my daily work relay on the updated data.

    where shall i include call logSomething? before the end of each subroutin?

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I assume you wanted it to log errors or what not... So I was going to suggest in your error handlers!
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •