can't get my vb6 project to run with MQ

Posted on 2009-04-08
Last Modified: 2012-05-06
I'm trying to write a VB6 project that uses mqax200.dll.  I have sample code from IBM that looks very solid, but the VB6 project won't run.  The variable declarations work fine, but I get an "automation error" when I try to run the project.  I have the mqax200.dll on the reference list.  I assume something else needs to be on my reference list, but what???  Thanks in advance for your help.
Private Sub Main()


    Dim qMgr As MQQueueManager

    Dim mqSess As New MQSession


    Dim inputMsg As New MQMessage

    Dim inputOptions As New MQGetMessageOptions

    Dim inputQueue As MQQueue


    Dim outputMsg As New MQMessage

    Dim outputQueue As MQQueue


    'Create a session, connect to Queue Manager


    Set qMgr = mqSess.AccessQueueManager("QMNT")



    'Open input and output queues


    Set inputQueue = qMgr.AccessQueue("AS400.To.NT", _

                                      MQOO_INPUT_AS_Q_DEF + _

                                      MQOO_FAIL_IF_QUIESCING + _



    Set outputQueue = qMgr.AccessQueue("NT.To.AS400", _

                                       MQOO_OUTPUT + _



    'Put the customer number into the output message


    outputMsg.CharacterSet = 37

    outputMsg.DataOffset = 0

    outputMsg.WriteString txtCustomerNumber



    'Send the customer number message


    outputQueue.Put outputMsg



    'Set the Get Message Options


    inputOptions.Options = MQGMO_WAIT + _



    inputOptions.WaitInterval = MQWI_UNLIMITED


    inputQueue.Get inputMsg, inputOptions




    'Get message data field values


    With inputMsg


        txtCustomerNumber = .ReadString(6)

        lblDataName = .ReadString(3) + _

                      " " + _



        If Not (Trim(lblDataName) = "NOTFOUND") Then

            lblDataCreditLimit = Format(.ReadString(4), "###0")

            lblDataBalanceDue = Format(CDec(.ReadString(6)) / 100, "###0.00")

            lblDataCreditDue = Format(CDec(.ReadString(6)) / 100, "###0.00")

        End If


    End With


End Sub

Open in new window

Question by:thomsone
  • 2

Expert Comment

ID: 24110106
when do you get this error?

Author Comment

ID: 24110124
At run-time.

Accepted Solution

thomsone earned 0 total points
ID: 24357978
Answered myself.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access - Capture pressed key onclick 4 28
vb6 connector to mongodb 2 45
Add and format columns in vb6 7 42
MsgBox 4 42
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

948 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now