Link to home
Start Free TrialLog in
Avatar of NTNBower
NTNBower

asked on

Illegal reference to function in Lotus Script

I am writing a Lotus Notes agent in Lotus Script and trying to call a function from a script library.

The library name is Trans4mRoutines.  The library saves with no errors.
Library Function
*****************************************************************
Function OpenT4m()
      Dim msgstr As String
      
      On Error Goto OpenT4mErr
      
      Set UDSession = CreateObject("Uniobjects.Session.1")
      UDSession.HostName = "Trans4m"
      UDSession.AccountPath = "/NTN/DATA/PRODUCTION"
      UDSession.UserName = "Micro"
      UDSession.Password = "Micro"
      
      Print "Connecting to Unidata.  Please wait."
      UDSession.Connect
      
      ' Make sure we have a connection
      If UDSession.IsActive Then
            OpenT4m = 0
      Else
            msgstr = "TRANS4M Connection Failed"
            Messagebox msgstr, MB_OK
            OpenT4m = -1
      End If
      On Error Goto 0
      Exit Function
      
OpenT4mErr:
      msgstr = "Error opening TRANS4M Connection at line # " +  Cstr(Erl) + Chr$(10) + Chr$(13)
      msgstr = msgstr + "Error Number " + Cstr(Err) + Chr$(10) + Chr$(13)
      msgstr = msgstr + Error + Chr$(10) + Chr$(13)
      Messagebox msgstr, MB_OK
      OpenT4m = -1
      On Error Goto 0
End Function

*************************************************************
Here is the use statement in the agent
*************************************************************
Option Public
Use "Trans4mRoutines"

**************************************************************
Here is the agent code that throws the error.
***************************************************************
Sub ExamineDocs()
      Set sNotes = New NotesSession
      Set dbNotes = s.CurrentDatabase
      Set vwNotes = dbNotes.GetView("($All)")
      Set docNotes = vwNotes.GetFirstDocument
      Dim Result As Integer
      
      ' Open TRANS4M Session      
      Result = OpenT4m()   **** This line throws the error ****
      If (Result = 0) Then
            If (OpenT4mFile("A_P-PAYMENT-HIST_MA")  = "") Then  *** No erroron this Function call ***
                  Call CloseT4m()   *** No error on this subroutine call ***
                  Goto EndProgram
            End If
      Else
            Goto EndProgram
      End If
.
.
.
.
End Sub

Can anyone tell me why the Call to OpenTrans4m throws an error?
Avatar of behenderson
behenderson
Flag of United States of America image

Function OpenT4m() as Integer
ASKER CERTIFIED SOLUTION
Avatar of behenderson
behenderson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sjef Bosman
Just a suggestion: in the Designer, activate the option to always include an Option Declare in your code automatically.
Avatar of NTNBower
NTNBower

ASKER

Thanks.  I knew better, but was in a hurry and missed it.