If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Error 91 Object variable not set

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-29-03, 18:39
VBGal VBGal is offline
Registered User
 
Join Date: Sep 2003
Posts: 3
Exclamation 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
__

______________
Reply With Quote
  #2 (permalink)  
Old 10-01-03, 19:33
bill_dev bill_dev is offline
Registered User
 
Join Date: Sep 2003
Posts: 60
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)
Reply With Quote
  #3 (permalink)  
Old 10-03-03, 10:46
VBGal VBGal is offline
Registered User
 
Join Date: Sep 2003
Posts: 3
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!!
Reply With Quote
  #4 (permalink)  
Old 10-03-03, 12:25
bill_dev bill_dev is offline
Registered User
 
Join Date: Sep 2003
Posts: 60
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?
Reply With Quote
  #5 (permalink)  
Old 10-03-03, 14:51
VBGal VBGal is offline
Registered User
 
Join Date: Sep 2003
Posts: 3
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 helphttp://www.microsoft.com/downloads/d...displaylang=en)

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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On