This is in a module as a public function. Yes, I know it doesn't return anything, could be a Sub, but it works.
Tobi Hoffman – [EMAIL PROTECTED]
Function Instrumented(strError As String)
' Comments : Write all errors to a log file
' Parameters: strError-- string sent in error trap
'=============================================================
Dim strLog As String
Dim strUser As String
Dim strMsg As String
Dim intFile As Integer
strLog = "\\PathOnServer\AppErrorLog.log"
intFile = FreeFile()
If FileExists(strLog) Then
Open strLog For Append As #intFile
Else
Open strLog For Output As #intFile
End If
strUser = Nz(GetUserName,"Not logged in") ' whatever function you use to get a user name
' strMsg gives it a timestamp, user's name, then on next line, the error you sent.
strMsg = Now() & " " & strUser & vbCrLf & strError
Print #intFile, strMsg
Close intFile
End Function
Then in the error trap section of every module:
ErrorTrap:
MsgBox Err.Description
Instrumented "frmSites!cmdDelete_Click: " & Err.Description
Resume Exit_cmdDelete_Click
End Sub
Dawn
Crosier
Application Specialist
"Education Lasts a Lifetime"
This message was posted
to a newsgroup. Please post replies and questions to the group so that
others can learn as well.
From: AccessDevelopers@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Trent Johnsey
Sent: Wednesday, January 11, 2006 9:45 PM
To: AccessDevelopers@yahoogroups.com
Subject: [AccessDevelopers] Verify File Exists
My problem is i am not sure how to check to see if the file exists. If the document exists, then I plan on opening the document using the shell command. Everything is fine with this process. However, I am running into issues determine if the file exists prior to opening it. Any assistance would be appreciated.
thanks
TJ
Please zip all files prior to uploading to Files section.
Microsoft access developer | Microsoft access help | Microsoft access database |
Microsoft access training | Microsoft access training course | Microsoft access programming |
YAHOO! GROUPS LINKS
- Visit your group "AccessDevelopers" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.