jth41
jth41

Reputation: 3906

Vb6 Form Load error

I am having difficulty debugging a simple application that I am writing in vb6. All I am attempting to do at this stage is to open a form and populate a combobox with entries from a database.

here is my code:

 Public Sub Form_Load()

''''''''''''''''''''''''''''Fill ComboBox with open Tickets'''''''''''''''''''
Dim Sqlstring As String
Dim rstCurrentTickets As Recordset

Sqlstring = "Select * from TroubleTickets where ResolvedDate IS Null"
Set rstCurrentTickets = cnnSel.OpenRecordset(Sqlstring)

Do While Not rstCurrentTicket.EOF

If Not IsNull(rstCurrentTicket.Fields!TroubleTicketId) Then
        TicketComboBox.AddItem (Trim(rstCurrentTicket.Fields!Title))
End If
TicketComboBox.MoveNext
Loop
''''''''''''''''''''''''''''End of Segment'''''''''''''''''''


If CreateNewTicketRadioButton.value = True Then
CreateSubmitButton.visible = True
CloseButton.visible = False
EditButton.visible = False

ElseIf (EditOpenTicketRadioButton.value = True) Then

CreateSubmitButton.visible = False
CloseButton.visible = False
EditButton.visible = True

ElseIf (CloseResolvedTicketRadioButton.value = True) Then

CreateSubmitButton.visible = False
CloseButton.visible = True
EditButton.visible = False

End If



End Sub

When I run it in the debugger it stops on the Load Sub and gives the error: "Compile error: Method or Data member not found."

The help is appreciated!

Upvotes: 0

Views: 953

Answers (1)

Jon Egerton
Jon Egerton

Reputation: 41549

There's a typo on the line

Do While Not rstCurrentTicket.EOF

It should have an s at the end of the variable name:

Do While Not rstCurrentTickets.EOF

There are similar problems in other places where you reference this variable.

You really need to turn on Option Explicit in your VB6 IDE, and make sure that every form/module/class you already created has it at the top of the file. This forces all variables ot be properly declared and will get rid of lots of these hard to find bugs.

Upvotes: 4

Related Questions