Just downloaded LibreOffice a few days ago. I am running version 7.2.5.2 on Mac OS 12.1. I have looked all over and can’t find an answer and can’t wrap my head around this.
We’re trying to transfer everything over from MS Access to Base. I need to get the database to do a simple calculation though.
I have fields for people that give every month named "Jan Total, Feb Total, Mar Total’ and so on. I need to add all those together into another field I have named “Year To Date.” I need it to all be in the same database and not in a separate query. I found an answer on here (and now can’t find again) that said to either do it as a query and save the file, close, and re-open to update it or have it automatically update using a Macro. I really need it to automatically update.
If there is another way, please let me know.
I’ve been looking at the Macro code the other poster had I was trying to see about changing it to fit my scenario, but can’t get it working. Any help would be greatly appreciated. Thanks so much.
This is the code the other person had for their macro:
REM ***** BASIC *****
Option Explicit
Sub UpdateVat
Dim oForm As Object
Dim oColumns As Object
Dim oVat As Object
Dim oTotalCost As Object
Dim dVatValue AS Double
Dim dDelCost AS Double
Dim dCost AS Double
Dim dTotalCost AS Double
oForm = ThisComponent.Drawpage.Forms.getByName("MainForm") 'Get Form to access payment grid
dDelCost = oForm.fmtDELCOST.Value
dCost = oForm.fmtCOST.Value
dVatValue = dCost * .2
oForm.fmtVAT.Value = dVatValue
dTotalCost = dCost + dDelCost + dVatValue
oForm.fmtTOTALCOST.Value = dTotalCost
oColumns = oForm.getColumns()
oVat = oColumns.getByName("VAT")
oVat.updateDouble(dVatValue)
oTotalCost = oColumns.getByName("TOTALCOST")
oTotalCost.updateDouble(dTotalCost)
UpdateTotalCost
End Sub
Sub UpdateTotalCost
Dim oForm As Object
Dim oColumns As Object
Dim oVat As Object
Dim oTotalCost As Object
Dim dVatValue AS Double
Dim dDelCost AS Double
Dim dCost AS Double
Dim dTotalCost AS Double
oForm = ThisComponent.Drawpage.Forms.getByName("MainForm") 'Get Form to access payment grid
dDelCost = oForm.fmtDELCOST.Value
dDelCost = oForm.fmtDELCOST.Value
dCost = oForm.fmtCOST.Value
dVatValue = dCost * .2
oForm.fmtVAT.Value = dVatValue
dTotalCost = dCost + dDelCost + dVatValue
oForm.fmtTOTALCOST.Value = dTotalCost
oColumns = oForm.getColumns()
oVat = oColumns.getByName("VAT")
oVat.updateDouble(dVatValue)
oTotalCost = oColumns.getByName("TOTALCOST")
oTotalCost.updateDouble(dTotalCost)
End Sub