Chapter 11 Pg 334 Running Balance
Hi
I have tried to use the Code as given on Page 332 for the running balance in rpts.
The expression On Open you entered as the event property setting produced the following error User defined type not defined
code as I have typed
Option Compare Database
Option Explicit
'Create a variable to hold the running balance.
Dim mdblBalance As Double
Private Function GetStartingBalance()
'Get Starting Balance
GetStartingBalance = -900000.25
End Function
Private Sub Report_Open(Cancel As integer)
' Initalize the running balance to previous balance
mdblBalance = GetStartingBalance
'Set Starting Balance
txtBalance_Starting = mdblBalance
End Sub
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
'Increase the balance by the current transaction amount
mdblBalance = mdblBalance + txtAmount
'Set the balance to the new balance
txtBalance = mdblBalance
End Sub
Private Sub ReportFooter_Print(Cancel As integer, PrintCount As Integer)
'Set the ending Balance to the final balance amount
txtBalance_Ending = mdblBalance
End Sub
I have managed to find the errors in the code as given in the book.
I have corrected the code and it works beautifully.
If anyone wants the code message me.
|