Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What can I do if DAO.Recordset doesn't work

Status
Not open for further replies.

travismallen

Programmer
Aug 5, 2003
15
US
I can't use DAO.Recordset with my Access and I need in a 'For/Next' Loop. This is the program:
'-------------------------------------------------

Dim Check
Dim Counter
Dim TempLoc
Dim rst as DAO.Recordset
Dim i as integer, NumRec as integer
Set rst = CurrentDb.OpenRecordset("tblMsgBank")

Check = True
Counter = 0

Do while Check = True

With Section

TempLoc = .Column(.BoundColumn + 1)&"."&Left(Me.Title,3)&"."&Trim(Counter)

End With

'Start the loop

With rst

.Movelast
NumRec = .Recordcount
.Movefirst

For i = 0 to NumRec - 1

If !Location = TempLoc Then

Check = True
Counter = Counter + 1

Else

Check = False

End If

.MoveNext
Next i

End With

Loop

rst.Close
set rst = Nothing

Me.Location = TempLoc
'-----------------------------------------
can anyone give me an alternative? Thanks


___________________________
"I am what I am" - Popeye
Travis M. Allen
 
Why can't you use DAO? It doesn't work? It is against policy? What version of Access?
 
I don't know, it just threw an error that it couldn't recognize the type for the variable 'rst'. I have Access 2000.

___________________________
"I am what I am" - Popeye
Travis M. Allen
 
Check your references and make sure that you have the Microsoft DAO library selected, if not select it and all should be good.

Regards,
gkprogrammer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top