Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003

    Exclamation Unanswered: Error 91 Object variable not set

    In a VB 6 program I get 'Error 91 object variable or with block variable not set'. The code is below and the error occurs on line 1020. A class is used, it is declared as a new class in a module.
    If more info is needed please let me know, your help is appreciated.

    In a module I declare:
    Public cbDataConn As New clsDB
    Private Sub CheckMail()

    1000 Dim rst As Recordset

    1010 On Error GoTo ErrHandler

    **1020 If IsNull(rsLocal("CurrentOperatorID")) Or RestoringRun Then
    1030 Exit Sub
    1040 End If

    1050 Set rst = cbDataConn.GetData("SELECT * FROM viewOpMail WHERE ViewedAt is NULL AND Retired=0 and OperatorID=" & rsLocal("CurrentOperatorID") & " ORDER BY SentAt ASC")

    1060 While Not rst.EOF

    1070 With frmMail
    1080 .txtMessage = rst("Message")
    1090 .lbFrom = rst("FromName")
    1100 .lbSentAt = Format(rst("SentAt"), "mm/dd/yyyy hh:mm AMPM")
    1110 .lbSubject = rst("Subject")
    1120 UserControl.Enabled = False
    1130 .Show vbModal
    1140 UserControl.Enabled = True
    1150 cbDataConn.GetData ("UPDATE lnkOperatorMail SET ViewedAt=getdate() WHERE OperatorID=" & rst("OperatorID") & " AND MailID=" & rst("MailID"))

    1160 If rst("ReturnRecept") = True Then
    1170 cbDataConn.SendMail rst("Email").Value, "Your message has been read", "On " & Now & " operator " & lbCurrentOperator.Caption & " on machine " & strModel & " read you note from " & Format(rst("SentAt"), "mm/dd/yyyy hh:mm AMPM") & " with subject: " & rst("subject"), "OBJECTIVE OperatorInterface", MAILHANLDER_LOWPRIORITY
    1180 End If

    1190 End With

    1200 rst.MoveNext
    1210 Wend

    1220 EXITPROC:
    1230 Exit Sub
    1240 ErrHandler:
    1250 Debug.Print Err.Number & ": " & Err.Description & " @ Line " & Erl
    1260 Debug.Assert False
    1270 Call ERHandler(Erl, Error, Err, "ucOperatorInterface" & "::" & "CheckMail")
    End Sub


  2. #2
    Join Date
    Sep 2003
    Anything on that line could be the problem...rsLocal isnn't declared or instantiated. I don't see where RestoringRun is declared or instantiated.

    Can you put a breakpoint on that line, run the program and, when it stops, hover your mouse over those items? If they are "Nothing" then that is the problem. You may have to highlight then and Shift-F9 (Quick watch in VS6)

  3. #3
    Join Date
    Sep 2003
    Thanks -- I tried that and they had values? Which led me to think that in some cases their losing them, but I'm not sure how. More info:

    This variable is declared and set above the procedure I previously sent:
    Private RestoringRun As Boolean
    1070 RestoringRun = False

    rsLocal is also filled in the Initialize sub

    Could this be an MDAC issue? I tried installing the latest, but no luck.
    Any further help would be appreciated greatly!!

  4. #4
    Join Date
    Sep 2003
    It doesn't fail every time? I don't think its any MDAC issue. Have you put a Debug.Print in the initialize event to see it executes when you expect it to?

  5. #5
    Join Date
    Sep 2003
    There is a Debug.print in the initialize and I don't see problems there. The funny thing is this used to work fine, no major code changes have been done for awhile. So I installed the Q331953 patch on a couple of the individual machines to see if it would help

    After reviewing the error log again here are other errors that starting occuring at the same time:

    Method cannot be invoked on business object.
    Error 4101 in clsDB::GetRS
    Error 4101 in clsDB:aveRS

    Business object cannot be created.
    Error 4100 in clsDB::Execute
    Error 4100 in modGlobal::ConvertNumeric

    Any other suggestions would be helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts