Solved

Communication Error

Posted on 1998-06-03
1
219 Views
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:

Syntax

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
0
Comment
Question by:gima
1 Comment
 
LVL 1

Accepted Solution

by:
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


0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

821 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