Macro error "oColumns.getByName" in my Base Form

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

@weaverman55 Have just discovered you are also posting same questions on another forum:

Text boxes in base form with their values tallied

syntax for retrieving textbox value

Although there is nothing wrong in doing this, cross posting as such should be noted in the question. What you are doing is having people work on a resolution which may have already been answered elsewhere. That is certainly the case here. This is wasting peoples time.

Will carefully consider posting answers to any further questions you post.

Hello,

This is one of the problems with using macros when it is unknown how they work. When working code is given (previous answer), it should be understood before modifying.

In oForm.getColumns you are obtaining the field name in the table record. Since you have not provided any necessary details about the form or table or even the specific error (syntax error can be all kinds of different things), the likely cause of the problem is that this is not the name of the field in the table. It is also a educated guess this amount is going to be saved in a table field. If only in a form field, approach is all wrong.

Edit 2019-03-01:

OK, I’ve stated this previously that macros should be avoided especially in your case (new, inexperienced user). Personally don’t see reason to have “Net Profit” on a data entry screen. This should be either on another form or even a report.

Regardless, attached is a Base sample without macros. It uses the the .odb sample from a previous question of yours and has the form modified to what I understand in your question. The SQL simply takes records and creates a “Net” amount which is used on a sub form of the existing form. The sub form is based upon a Query (SQL) named “CreateNet”. The information is only available after the record has been entered and saved. The “Net” field on the form is set to not allow modification.

Sample------- ReelToReelSQL.odb

When i click on the button oForm.getColumns is highlighted in the Macro code and a syntax error message pops up. I’ve uploaded my odb to the original post.

Again, what is the message???

Don’t see any .odb posted in the question - posted somewhere else???