IsError / LastError

Top  Previous  Next

Object: EHL7.EHL7Message

FileName: EHL7.dll

 

 

PROPERTY

 

These two properties go hand in hand

 

Name: IsError

DataType: Boolean

Mode: Readonly

Description: Returns the error state of the object

 

PROPERTY

 

Name: LastError

DataType: String

Mode: Readonly

Description: Returns the last error message generated by the object.

 

Every time you issue a call to a method in the EHL7.EHL7Message object you can check these two properties.

 

If IsError is True you can display or act on the contents of the LastError Property.

 

Example:

Private Sub MessageTest()

Dim myVendorObj As New EHL7.HL7Vendors

Dim myMsg As New EHL7.EHL7Message

Dim strVendorID As String

Dim oSegment As Object

myVendorObj.VendorPath = "C:\EasyHL7"

strVendorID = myVendorObj.GetVendorID("Default","2.3")

If strVendorID = "" Then

    MsgBox myVendorObj.LastError

    Set myVendorObj = Nothing

    Exit Sub

End If

If Not myVendorObj.OpenVendor(strVendorID) Then

    MsgBox myVendorObj.LastError

    Set myVendorObj = Nothing

    Exit Sub

End If

With myMsg

   Set oSegment = .CreateMessage(myVendorObj)

   If .IsError Then

     MsgBox .LastError

     Exit Sub

   End If

End With

End Sub