I created a form where there is 3 text boxes that i will enter dollar amounts into. I have a 4th text box that i want updated with the results of adding the values of two of the boxes (Shipping Cost and Fees) and then subtracting that value from the third text box value (Amount). I have a macro applied to a button that should put the value into the 4th text box (NetProfit). I have attached my coding for the Macro. I will get a syntax error " oColumns.getByName()" when i press the button. I am a total newbie at this and trying to absorb as much as i can but age is definitely a factor.
Thanking you in advance for any and all consideration.
Option Explicit
Sub CalculateNetProfit
Dim oForm As Object
Dim oColumns As Object
Dim dBaseAmount As Double
Dim dBaseShippingCost As Double
Dim dBaseFees As Double
Dim dBaseNetProfit As Double
oForm = ThisComponent.Drawpage.Forms.getByName("MainForm")
dBaseAmount = oForm.getByName("Amount").getCurrentValue()
dBaseShippingCost = oForm.getByName("Shipping Cost").getCurrentvalue()
dBaseFees = oForm.getByName("Fees").getCurrentValue()
dBaseNetProfit = 0.00
if dShippingCost Or dFees Then
dBaseNetProfit = dBaseShippingCost + dBaseFees
Else
dBaseNetProfit = 0.00
End
if dAmount Then
dBaseNetProfit = dBaseNetProfit + dBaseAmount
End if
Rem Obtain and update NetProfit
oColumns = oForm.getColumns()
oColumns.getByName(“NetProfit”).updateDouble(dBaseNetProfit)
End Sub