Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 7th, 2006, 03:52 AM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Runtime error 91:

Hello, I'am rather new to VB6 programming. When I run my program, i get runtime error 91: Objevt Variable or with block variable not set.

When debugging the program stops at the line in Bold
when I delete this line the program works perfect.

If you need more info, let me know.


[code]
Private Sub dgAuteurs_Click()
    adoTitels.Recordset.Filter = "auteur_id = '" & adoAuteur.Recordset.Fields("auteur_id").Value & "'"

adoTitelsBezit.Recordset.Filter = "auteur_id = '" & adoAuteur.Recordset.Fields("auteur_id").Value & "'"

    dgTitels.Visible = True
    txtTeller.Visible = True
    lblAantalTitels.Visible = True
    imgCover.Visible = False
    'Tellen aantal titels
    Dim tel As Integer
    tel = 0
    adoTitels.Recordset.MoveFirst
    While Not adoTitels.Recordset.EOF
        tel = tel + 1
        adoTitels.Recordset.MoveNext
    Wend
    txtTeller.Text = tel
    If tel = 1 Then lblAantalTitels.Caption = "Titel" Else lblAantalTitels.Caption = "Titels"
        adoTitels.Recordset.MoveFirst

End Sub
[end code]

 
Old June 7th, 2006, 09:47 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well... the obvious solution is to DELETE THAT LINE. If the program works perfect without it, then it is superflous and you can delete it.

Of course, we will deal with the potentiallity that you actually need this line.

The reason you are getting that error is that the either the adoTitelsBezit object has not yet been instantiated, or the Recordset object that is apparently a property of the adoTitelsBezit object hasn't been instantiated. Either way, you get the error 91 when you are working with variable that references an object that "is nothing" - which essentially means it hasn't been created yet.

Woody Z http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 91 GVBGVB Excel VBA 2 April 4th, 2008 12:56 AM
error 91 skrj02 Excel VBA 4 May 7th, 2007 11:01 AM
error 91 issues. kd8con Beginning VB 6 1 October 30th, 2006 09:50 AM
runtime error 91 Perseus Beginning VB 6 2 July 30th, 2005 04:36 AM
Ch4 Runtime Error 91 using db source code zip file Matrix_zero BOOK: Beginning Access 2003 VBA 0 March 1st, 2005 08:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.