luvlylittlelady
Programmer
I have written some code to link VB to an access table, evcery time it runs i get an error "91" saying - Object variable or with block variable not set?
Not sure where i am going wrong
Code below is on a button - it keeps pointing to the first line of - Data1.Recordset.Movefirst
**Code**
List1.Clear
List2.Clear
Data1.Recordset.MoveFirst
Text2.Text = UCase(Data1.Recordset.Fields("Hotel ID".Value)
Data2.Recordset.MoveFirst
While Not Data1.Recordset.EOF
List1.AddItem UCase(Data1.Recordset.Fields("Hotel ID".Value)
If UCase(Text1.Text) = UCase(Data1.Recordset.Fields("hotel ID".Value) Then
Text2.Text = UCase(Data1.Recordset.Fields("hotel type".Value)
End If
Data1.Recordset.MoveNext
Wend
Data1.Recordset.MoveFirst
While Not Data2.Recordset.EOF
List2.AddItem UCase(Data2.Recordset.Fields("hotel name".Value)
If UCase(Text1.Text) = UCase(Data2.Recordset.Fields("hotel id".Value) Then
Text3.Text = UCase(Data2.Recordset.Fields("town".Value)
End If
Data2.Recordset.MoveNext
Wend
Data1.Recordset.MoveFirst
Data2.Recordset.MoveFirst
Not sure where i am going wrong
Code below is on a button - it keeps pointing to the first line of - Data1.Recordset.Movefirst
**Code**
List1.Clear
List2.Clear
Data1.Recordset.MoveFirst
Text2.Text = UCase(Data1.Recordset.Fields("Hotel ID".Value)
Data2.Recordset.MoveFirst
While Not Data1.Recordset.EOF
List1.AddItem UCase(Data1.Recordset.Fields("Hotel ID".Value)
If UCase(Text1.Text) = UCase(Data1.Recordset.Fields("hotel ID".Value) Then
Text2.Text = UCase(Data1.Recordset.Fields("hotel type".Value)
End If
Data1.Recordset.MoveNext
Wend
Data1.Recordset.MoveFirst
While Not Data2.Recordset.EOF
List2.AddItem UCase(Data2.Recordset.Fields("hotel name".Value)
If UCase(Text1.Text) = UCase(Data2.Recordset.Fields("hotel id".Value) Then
Text3.Text = UCase(Data2.Recordset.Fields("town".Value)
End If
Data2.Recordset.MoveNext
Wend
Data1.Recordset.MoveFirst
Data2.Recordset.MoveFirst