I'm attempting to update a field in the table from the Max Date field in another table using VBA code. I attempted to simply use an Update query, however, I read that JET won't allow my query that gets the Max date to be utilized in an Update query. Hence, this is the solution I came up with.
When I try to run it to test the data, it only updated the first row, then crashed Access. Any ideas?
When I try to run it to test the data, it only updated the first row, then crashed Access. Any ideas?
Code:
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM PayrollRequestTbl")
If rs.BOF And rs.EOF Then
Else
Do Until rs.EOF
navDate = rs!MCR_RecentNAV
navDate = DMax("NAV_Date", "NAV_Tbl")
rs.Edit
rs!MCR_RecentNAV = navDate
rs.Update
Loop
rs.Close
Set rs = Nothing
Comment