debbiedoobie10
Registered User.
- Local time
- Today, 09:05
- Joined
- Oct 1, 2010
- Messages
- 13
When I run the code below in Access 2013 it works. When I run the code below in Access 2016 it works sometimes. When I step into the code and stop the code when the data is wrong. I went into the table and removed the wrong data then went back to the step into code and continue it works. Most of the time it works, there are only a few records that have wrong data, but I have not found a pattern. Does anyone have any suggestions?
CodeTPCash()
Function CodeTPCash()
Dim intDayCtr As Integer
Dim rstbltp64g As DAO.Recordset
Dim rstbltp66g As DAO.Recordset
Set MyDB = CurrentDb
Set rstbltp64g = MyDB.OpenRecordset("tblTP64G", dbOpenForwardOnly)
Set rstbltp66g = MyDB.OpenRecordset("tblTP66G", dbOpenForwardOnly)
With rstbltp66g
Do While Not .EOF
For intDayCtr = 0 To DateDiff("d", ![tBegbalDate], ![tDate]) - 1
DoCmd.OpenQuery "qryTP82G", , acReadOnly
qryTP81G
Field: mDate TotalCash
Table: TblTP64G TblTP64G
Total: Min group By
Criteria: is null
qryTP82G
Field: trxdate runningtotal Minofmdate
Table: tblTP31G tbltp31G qryTP81G
Total: Group By Sum Group by
Criteria: <=[minofmdate]
DoCmd.OpenQuery "qryTP84G", , acReadOnly
qryTP84G
Field: TotalCash
Table: TblTP64G
Update to: [tblTP83G]![sumofrunningtotal]
Next
.MoveNext
Loop
End With
DoCmd.OpenQuery "qryTP86G", acViewNormal, acEdit
rstbltp64g.Close
rstbltp66g.Close
Set rstbltp64g = Nothing
Set rstbltp66g = Nothing
End Function
CodeTPCash()
Function CodeTPCash()
Dim intDayCtr As Integer
Dim rstbltp64g As DAO.Recordset
Dim rstbltp66g As DAO.Recordset
Set MyDB = CurrentDb
Set rstbltp64g = MyDB.OpenRecordset("tblTP64G", dbOpenForwardOnly)
Set rstbltp66g = MyDB.OpenRecordset("tblTP66G", dbOpenForwardOnly)
With rstbltp66g
Do While Not .EOF
For intDayCtr = 0 To DateDiff("d", ![tBegbalDate], ![tDate]) - 1
DoCmd.OpenQuery "qryTP82G", , acReadOnly
qryTP81G
Field: mDate TotalCash
Table: TblTP64G TblTP64G
Total: Min group By
Criteria: is null
qryTP82G
Field: trxdate runningtotal Minofmdate
Table: tblTP31G tbltp31G qryTP81G
Total: Group By Sum Group by
Criteria: <=[minofmdate]
DoCmd.OpenQuery "qryTP84G", , acReadOnly
qryTP84G
Field: TotalCash
Table: TblTP64G
Update to: [tblTP83G]![sumofrunningtotal]
Next
.MoveNext
Loop
End With
DoCmd.OpenQuery "qryTP86G", acViewNormal, acEdit
rstbltp64g.Close
rstbltp66g.Close
Set rstbltp64g = Nothing
Set rstbltp66g = Nothing
End Function