Access VBA code works sometimes after 2016 conversion (1 Viewer)

debbiedoobie10

Registered User.
Local time
Today, 03:21
Joined
Oct 1, 2010
Messages
13
The code below was created in access 2013. I am in the process of upgrading to access 2016 and this code works sometimes. My process to find that this is the code that is not working is to step into the code and stop when the data is incorrect. Remove the data that is incorrect and step into the code again and this time it will work. I have not found a pattern to the why it works sometime. Can anyone help?

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

Query qryTP81G
Field: mDate TotalCash
Table: TblTP64G TblTP64G
Total: Min group By
Criteria: is null

Query qryTP82G
Field: trxdate runningtotal Minofmdate
Table: tblTP31G tbltp31G qryTP81G
Total: Group By Sum Group by
Criteria: <=[minofmdate]


DoCmd.OpenQuery "qryTP84G", , acReadOnly
Query 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
 

Users who are viewing this thread

Top Bottom