I have a code as follows that I have put behind a button:
Private Sub Command4_Click()
'Declare you variables
Dim dbs As Database
Dim rst As DAO.Recordset
Dim Counter As Integer
' set up a updateable recordset of your table
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(cus, dbOpenDynaset)
' find number of records in your recordset
Counter = rst.RecordCount
' loop until run out of records
While Counter > 0
With rst
' sets your field to date for example
![CustomerID] = Date
End With
' moves to next record
rst.MoveNext
' one less record to go
Counter = Counter - 1
' start loop again
Wend
End Sub
It is throwing an error saying that it cannot find the table.However the table does exist. I am using access 2002. I hope someone can help me figure out what mistake I might have made.
Thank You!
Private Sub Command4_Click()
'Declare you variables
Dim dbs As Database
Dim rst As DAO.Recordset
Dim Counter As Integer
' set up a updateable recordset of your table
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(cus, dbOpenDynaset)
' find number of records in your recordset
Counter = rst.RecordCount
' loop until run out of records
While Counter > 0
With rst
' sets your field to date for example
![CustomerID] = Date
End With
' moves to next record
rst.MoveNext
' one less record to go
Counter = Counter - 1
' start loop again
Wend
End Sub
It is throwing an error saying that it cannot find the table.However the table does exist. I am using access 2002. I hope someone can help me figure out what mistake I might have made.
Thank You!