Access 2003 Error Log
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn microsoft access error logs more about Stack Overflow the company Business Learn more about hiring developers or ms access log user activity posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community ms access log function Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Method for logging errors and warnings in MS Access up
Ms Access Log Files
vote 1 down vote favorite 1 I'm an intern who is making a billing database for a new market that my company is in. I have created all the tables, and have set up an automatic way to grab and import the data. However, the method of importing is sort of brute force and not very elegant, because I've only had like 2 weeks to work on it. ms access vba error handling I have linked tables set up in the database to CSV files I have append queries that will add new records to existing tables. Warnings are thrown for duplicate entries, but those can be ignored. What my company wants to do is every day run a program I created to download these reports, on a rolling interval of about 30 days. Then add any new records into the Access database. Since I'm leaving soon, I won't have time to test this database, and would like to have some method of documenting errors and warnings that are thrown; everything from a duplicate entry warning to a type mismatch error, or a syntax error in some SQL query. Is this possible and if so what do you think would be the most effective way to go about it? Maybe while my import macro is running open up an error handling function? We are working in Access 2007 if that helps. vba ms-access-2007 access-vba share|improve this question asked Jan 11 '12 at 16:53 Tom 3093617 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted You can write to a text file, for the most part, in the error
a full version of Access, while a run-time version just crashes. For a more detailed approach to error handling, see FMS' article on Error Handling and Debugging. The simplest approach is to display the Access error message and quit the procedure. Each procedure, then, will have this format (without the line numbers): 1 Sub|Function SomeName() 2 On Error GoTo Err_SomeName ' Initialize error handling. 3 ' Code to do something here. 4 Exit_SomeName: ' Label to resume after error. 5 Exit Sub|Function ' Exit before error handler. 6 Err_SomeName: ' Label to jump to on error. 7 MsgBox Err.Number & Err.Description ' Place error handling here. 8 Resume Exit_SomeName ' Pick up http://stackoverflow.com/questions/8823259/method-for-logging-errors-and-warnings-in-ms-access again and quit. 9 End Sub|Function For a task where several things could go wrong, lines 7~8 will be replaced with more detail: Select Case Err.Number Case 9999 ' Whatever number you anticipate. Resume Next ' Use this to just ignore the line. Case 999 Resume Exit_SomeName ' Use this to give up on the proc. Case Else ' Any unexpected error. Call LogError(Err.Number, Err.Description, "SomeName()") Resume Exit_SomeName End Select The Case Else in this http://allenbrowne.com/ser-23a.html example calls a custom function to write the error details to a table. This allows you to review the details after the error has been cleared. The table might be named "tLogError" and consist of: Field Name Data Type Description ErrorLogID AutoNumber Primary Key. ErrNumber Number Long Integer. The Access-generated error number. ErrDescription Text Size=255. The Access-generated error message. ErrDate Date/Time System Date and Time of error. Default: =Now() CallingProc Text Name of procedure that called LogError() UserName Text Name of User. ShowUser Yes/No Whether error data was displayed in MsgBox Parameters Text 255. Optional. Any parameters you wish to record. Below is a procedure for writing to this table. It optionally allows recording the value of any variables/parameters at the time the error occurred. You can also opt to suppress the display of information about the error. Function LogError(ByVal lngErrNumber As Long, ByVal strErrDescription As String, _ strCallingProc As String, Optional vParameters, Optional bShowUser As Boolean = True) As Boolean On Error GoTo Err_LogError ' Purpose: Generic error handler. ' Logs errors to table "tLogError". ' Arguments: lngErrNumber - value of Err.Number ' strErrDescription - value of Err.Description ' strCallingProc - name of sub|function that generated the error. ' vParameters - optional string: List of parameters to record. ' bShowUser - optional boolean: If False, suppresses display. ' Author: Allen Brow
Post your question and get tips & solutions from a community of 418,417 IT Pros & Developers. It's quick & easy. Are there logs for ODBC errors? Expert 100+ P: 1,204 jimatqsi I have a client running Access 2003 https://bytes.com/topic/access/answers/907921-there-logs-odbc-errors with a SQL back end. They are reporting a number of ODBC errors recently and complaining the system is crawling. (Each ODBC error takes about 1 minute to come up) Is there a place where I can find a log that would tell me more about these errors? Thanks, Jim Feb 8 '11 #1 Post Reply Share this Question 3 Replies Expert Mod 2.5K+ P: 2,543 Stewart Ross Hi Jim. You can use the ODBC driver administrator's trace facility to ms access generate a log file of activity between a particular start and stop time, as outlined in this MS support article: http://support.microsoft.com/kb/274551. -Stewart Feb 9 '11 #2 reply Expert 100+ P: 1,204 jimatqsi Thanks, Stewart. I'm going to try this but I'm not sure it's what I want. I'm actually looking for error logging and this is tracing, which I presume is a recording of every ODBC call. Using this will degrade system performance. Jim Feb 9 '11 #3 reply Expert Mod ms access log 2.5K+ P: 2,543 Stewart Ross Turning on tracing does indeed degrade performance to an extent (also referred to by MS in their support article). Unfortunately, I'm not aware of any actual error logging facilities that are built in to ODBC. When I've used the trace option myself it was to find out what was going on in an ODBC instance that had suddenly stopped functioning altogether after 18 months of normal functioning. What the trace showed in that case was that the driver was unable to communicate with the remote system and was continuously timing out, as a result of a software issue at the 'other' end. I don't know if the system event logs built in to Windows capture ODBC errors under the networking heading or not. Failing that there may be third-party tools available for this purpose, but I don't know of any off hand. -Stewart Feb 9 '11 #4 reply Message Cancel Changes Post your reply Join Now >> Sign in to post your reply or Sign up for a free account. Similar topics Close ODBC connection via code? Understanding ODBC connections...! ODBC Errors Resource grabbing Access - Jet - ODBC - SQL Server problems. How to handle Primary Key violations in a bound form without causing and ODBC error. trap odbc errors odbc errors ODBC SQL Server database reconnect questions odbc errors on terminal server ODBC Errors In Query Browse more Microsoft Access / VBA Questio