What's wrong with this code???

  • Thread starter Thread starter Betsy
  • Start date Start date
B

Betsy

I keep getting the error message "Object Required"
or 'Object Variable not set" if I take out the open
statement.

Sub UpdateStatus()

Dim tblWIAStudentInfo As ADODB.RecordSet
tblWIAstudnetinfo.Open

Do Until tblWIAStudentInfo.EOF = True
If tblWIAStatus_ID.OldValue = 1 Then
tblWIAStatus_ID.Value = 9
ElseIf tblWIAStatus_ID.OldValue = 4 Then
tblWIAStatus_ID.Value = 10
ElseIf tblWIAStatus_ID.OldValue = 5 Then
tblWIAStatus_ID.Value = 11
ElseIf tblWIAStatus_ID.OldValue = 6 Then
tblWIAStatus_ID.Value = 12
ElseIf tblWIAStatus_ID.OldValue = 7 Then
tblWIAStatus_ID.Value = 2
End If
tblWIAStudentInfo.MoveNext
Loop
tblWIAStudentInfo.Close
End Sub
 
Hi,
A record set is an Object so you have to 'Set' it to something,
as you do all object variables.

In this case:
Set tblWIAstudnetinfo = New ADODB.RecordSet

Next, here is the syntax to open a recordset:
recordset.Open Source, ActiveConnection, CursorType, LockType, Options

Take a look in Help for more info on opening ADO recordsets.
 
Back
Top