Communication Error

Posted on 1998-06-03
Last Modified: 2010-05-03
I am trying to log all my communication Error messages to the log file.
 ERMsg$ = "Break Received"
            lLogType = vbLogEventTypeError
            sPrintMsg = ERMsg$ & vbCrLf & _
            " Error: [" & Err.Number & "]: " & _
            Err.Description & " Error in: " & Err.Sorce
            App.LogPath = "C:\HLRS4.1\Error.log"
            App.StartLogging App.LogPath, vbLogAuto
            App.LogEvent sPrintMsg, lLogType
I created an empty log file on my c drive. But I am getting  error : Can't assign to the read-only property
 App.LogPath = "C:\HLRS4.1\Error.log"
Returns the path and filename of the file used to capture output from the LogEvent method. Not available at design-time; read-only at run time.

From the Help menu:


object.LogPath = path

Part      Description
object      An object expression that evaluates to an object                  in the Applies To list.
path      String. The path and filename of a log file.

what changes should i make to my code ? Thank you...

Private Static Sub MSComm1_OnComm()
    Dim EVMsg$
    Dim ERMsg$
    Dim sPrintMsg As String
    Dim lLogType As Long
    ' Branch according to the CommEvent property.
    Select Case MSComm1.CommEvent
        ' Event messages.
        Case comEvReceive
            Dim Buffer As Variant
            Buffer = MSComm1.Input
            Debug.Print "Receive - " & StrConv(Buffer, vbUnicode)
            ShowData txtTerm, (StrConv(Buffer, vbUnicode))
        Case comEvSend
        Case comEvCTS
            EVMsg$ = "Change in CTS Detected"
        Case comEvDSR
            EVMsg$ = "Change in DSR Detected"
        Case comEvCD
            EVMsg$ = "Change in CD Detected"
        Case comEvRing
            EVMsg$ = "The Phone is Ringing"
        Case comEvEOF
            EVMsg$ = "End of File Detected"

        ' Error messages.
        Case comBreak
            ERMsg$ = "Break Received"
            lLogType = vbLogEventTypeError
            sPrintMsg = ERMsg$ & vbCrLf & _
            " Error: [" & Err.Number & "]: " & _
            Err.Description & " Error in: " & Err.Sorce
            App.LogPath = "C:\HLRS4.1\Error.log"
            App.StartLogging App.LogPath, vbLogAuto
            App.LogEvent sPrintMsg, lLogType
Question by:gima
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

JayMerritt earned 20 total points
ID: 1462398
Try :

'REM App.LogPath = "C:\HLRS4.1\Error.log"
App.StartLogging "C:\HLRS4.1\Error.log", vbLogAuto
App.LogEvent sPrintMsg, lLogType


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
message box in access 4 55
How does CurrentUser work? 10 44
MS Access 03, TransferText, decimal places 8 92
Access2016 ignore hyphen in data entry or searches 5 70
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question