Hello All--
I am trying to loop through all the records in a table named: tbl_Scan_Index. I am using MS Access 2003. Here is my code(VBA):
My goal is to loop through all of the records, and count the number of records where Folder_Num (field in table) is equal to 1. I get an overflow error, and the counter goes way over the number of records that are in the table. Any ideas as to why? I am very new to DOA, and access programming. Thanks in advance.
I am trying to loop through all the records in a table named: tbl_Scan_Index. I am using MS Access 2003. Here is my code(VBA):
Code:
Dim drawer As Integer
Dim Folder As Integer
Dim msg As String
Dim count As Integer
drawer = 11
Folder = 1
Dim DB As Database
Dim rst As DAO.Recordset
Set DB = CurrentDb()
Set rst = DB.OpenRecordset("tbl_Scan_Index")
rst.MoveLast
rst.MoveFirst
While Not rst.EOF
If Me.Folder_Num.Value = Folder Then
count = count + 1
End If
Wend
msg = MsgBox(count, vbOKOnly)
Comment