Send message from VB - IBM AS400

This is a discussion on Send message from VB - IBM AS400 ; The following code will send an AS/400 message from a VB or VBA module. Public Sub SendAS400Message(MessageText As String, SendTo As String) Dim cnAS400 As ADODB.Connection Set cnAS400 = New ADODB.Connection cnAS400.Open "Provider=IBMDA400; data source=system_name", "user_name", "password" cnAS400.Execute "{{QSYS/SNDMSG MSG('" ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Send message from VB

  1. Send message from VB

    The following code will send an AS/400 message from a VB or VBA module.

    Public Sub SendAS400Message(MessageText As String, SendTo As String)
    Dim cnAS400 As ADODB.Connection
    Set cnAS400 = New ADODB.Connection
    cnAS400.Open "Provider=IBMDA400; data source=system_name", "user_name",
    "password"
    cnAS400.Execute "{{QSYS/SNDMSG MSG('" & MessageText & "') TOUSR(" & SendTo
    & ")}}", 0, adCmdText
    cnAS400.Close: Set cnAS400 = Nothing
    End Sub

    The message is sent by QUSER, so it needs extra text to display the UserName
    of the originator, which is hard to display tidily because of wrod wrapping.
    Is there an API that could be used instead or does anyone have alternative
    code please?

    Many thanks

    Peter Kinsman



  2. Re: Send message from VB

    Well there is the QMHSNDM API, but I don't see what the problem is
    with adding the UserName to the front (or back) of the MessageText
    variable.


+ Reply to Thread