Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 14th, 2004, 01:06 PM
Registered User
 
Join Date: May 2004
Location: HILLSBORO, OREGON, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default RUN TIME ERROR 91

I had created a back end program for my clients program it works fine as a stand alone program. my client wants this back end to be only open from his program. I then created code to pass arguments to the back end. I have compiled the back end and ran the program from the front end. The back end would load MINIMIZED on the task bar and when I tried to MAXIMIZE the back end from the task bar I would get an error [Run time ERROR 91]. I need some help with this error here is some of the code i think the error is coming from.

CODE
Code:
Code:Private Sub Form_Activate() 

Dim strValuesFromCommandLine() As String 
Dim CmdLine As String 
Dim RAFFLEID As String 
Dim PASSWORD As String 
Dim FirstTicketNo As String 
Dim LastTicketNo As String 
Dim number1 As String 

 strValuesFromCommandLine() = Split(Command$, ", ") 
 CmdLine = strValuesFromCommandLine(0) 
 RAFFLEID = strValuesFromCommandLine(1) 
 PASSWORD = strValuesFromCommandLine(2) 
 FirstTicketNo = strValuesFromCommandLine(3) 
 LastTicketNo = strValuesFromCommandLine(4) 

If PASSWORD = "TheSecretPassword" Then 
    If RAFFLEID > " " Then 

        'Enter RaffielD into textbox and press OK. 

        Data1.DatabaseName = DataPath 
        Data1.Connect = "; PWD=TheSecretPassword" 
        number1 = "select RaffieID, Prize1, NumberofTicketsAvailable, shortdescription, longdescription, raffleenddate, Ticketcost, " & _ 
        "Timeplace, CharityName from raffies Inner Join charity on Raffles.CharityIdd = charity.CharityId Where RaffielD like'" & RAFFLEID & "*'" 
        Data1.RecordSource = number1 
        Data1.Refresh 
        Data1.Recordset.FindFirst "RaffleID = '" & RAFFLEID & "'" 
    ElseIf Data1.Recordset.NoMatch Then 
        Frame3.Visible = True 
        Label4.Visible = True 
        Label4.Caption = "No such record was found." 
        End 
        End If 
ElseIf PASSWORD <> " TheSecretPassword" Then 
    Label4.Visible = True 
    Label28.Visible = False 
    Label29.Visible = False 
    Label4.Caption = "Enter the correct PASSWORD or see the administrator." 
End If 


DataPath = Mid(App.Path, 1, 29) & "rmdesktop\whdata.mdb" 
DataPath1a = Right(DataPath, 11) 

If Option2 = False Then 
    txtValue.Enabled = False 
    Text2.Enabled = False 
    cmdPrint_Singles.Enabled = False 
End If 

If Option1 = False Then 
    cmdPrint_All.Enabled = False 
End If 

End Sub
THANK YOU

If you need any more information I will get it to you
Reply With Quote
  #2 (permalink)  
Old May 14th, 2004, 01:09 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..
a little more info like what line of code throws the error would help...


HTH

Gonzalo
Reply With Quote
  #3 (permalink)  
Old May 14th, 2004, 01:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Is maximized and minimized the window state property, where the window is minimized or maximized, or has this something to do with the database?

Thanks.
Reply With Quote
  #4 (permalink)  
Old May 14th, 2004, 01:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Error 91 is object variable not set, the only object I can see in the code is Data1

BTW vb error handling is not great, but non using it is worse... :)

Marco
Reply With Quote
  #5 (permalink)  
Old May 14th, 2004, 01:59 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

probably this is wrong:

[code]
If RAFFLEID > " " Then
...
    ElseIf Data1.Recordset.NoMatch Then <----------- the data has not been set yet!!!!
        Frame3.Visible = True
        Label4.Visible = True
        Label4.Caption = "No such record was found."
        End
    End If

also

If PASSWORD = "TheSecretPassword" Then
...
ElseIf PASSWORD <> " TheSecretPassword" Then <--- why??? the if go to the second part if the first clause if not true..
    Label4.Visible = True
    Label28.Visible = False
    Label29.Visible = False
    Label4.Caption = "Enter the correct PASSWORD or see the administrator."
End If


[code]



HTH

Gonzalo
Reply With Quote
  #6 (permalink)  
Old May 14th, 2004, 05:36 PM
Registered User
 
Join Date: May 2004
Location: HILLSBORO, OREGON, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am going to get back to you tonight
thank you for responding
Reply With Quote
  #7 (permalink)  
Old May 15th, 2004, 08:08 PM
Registered User
 
Join Date: May 2004
Location: HILLSBORO, OREGON, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think I had found the area at which the program fails I had tried passing arguments from the code given to me by my client and tried opening the back end program with a false Password and it did ok and then I tried the RaffleId and it seemed to fail and so I figure that the RUN TIME ERROR 91 is comming from this portion of the code.

 
Code:
Data1.DatabaseName = DataPath
Code:
        Data1.Connect = "; PWD=TheSecretPassword" 
        number1 = "select RaffieID, Prize1, NumberofTicketsAvailable, shortdescription, longdescription, raffleenddate, Ticketcost, " & _ 
        "Timeplace, CharityName from raffies Inner Join charity on Raffles.CharityIdd = charity.CharityId Where RaffielD like'" & RAFFLEID & "*'" 
        Data1.RecordSource = number1 
        Data1.Refresh 
        Data1.Recordset.FindFirst "RaffleID = '" & RAFFLEID & "'" 
    ElseIf Data1.Recordset.NoMatch Then 
        Frame3.Visible = True 
        Label4.Visible = True 
        Label4.Caption = "No such record was found." 
        End 
        End If


before I Stuck the RaffleId code into Private Sub Form_Activate()I had it in a Command Button and it worked fine. At this time what should I do. What about put it into a Sub_Main() and then call it from there. Your advice is very helpful

THANK YOU

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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
Run Time Error '91' derniel VB Databases Basics 1 July 15th, 2005 12:52 AM
run time error ashishroyk Java GUI 0 October 8th, 2004 01:42 AM
Run Time Error JBond Access VBA 0 May 27th, 2004 09:50 AM
RUN-TIME ERROR compcad Beginning VB 6 2 May 21st, 2004 02:01 AM



All times are GMT -4. The time now is 09:17 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.