Note that there are some explanatory texts on larger screens.

plurals
  1. POVBA fails doing calculation on table columns
    primarykey
    data
    text
    <pre><code>Sub AddNumbersOnOneRow Const s_Field_ColA = "ColumnA" Const s_Field_ColB = "ColumnB" Const s_Field_ColC = "ColumnC" Const s_Field_ColD = "ColumnD" Dim iPsDepth As Integer Dim iPsColA As Integer Dim iPsColB As Integer Dim iPsColC As Integer Dim iPsColD As Integer Dim lRow As Long Dim dDepth As Double Dim ColumnD As Double '------------------------ 'Determine the field positions of the necessary fields in the array. If InitFieldsFnB(gs_Depth, iPsDepth, _ s_Field_ColA, iPsColA, _ s_Field_ColB, iPsColB, _ s_Field_ColC, iPsColC) _ Then 'One or more of the required fields missing from the table. Exit Sub End If With gINTRules.GridData iPsDepth = .FieldCol("Depth") iPsColA = .FieldCol("ColumnA") iPsColB = .FieldCol("ColumnB") iPsColC = .FieldCol("ColumnC") iPsColD = .FieldCol("ColumnD") For lRow = 1 To glNumRows ColumnD= CDbl(gsDataA(iPsColA, lRow))+ CDbl(gsDataA(iPsColB, lRow)) gsDataA(iPsColD, lRow)= CStr(ColumnD) Next lRow End With End Sub </code></pre> <p>When I run this macro, I didn't get any errors. However, this macro doesn't give me the answer, nothing in column D.</p> <p>I want to put the addition of column A and ColumnB into columnD ![This is my table, I want to put the addition of column A and ColumnB into columnD. But When I run the macro I get nothing.]</p> <p>I suspect that the following lines are giving me trouble:</p> <pre><code>For lRow = 1 To glNumRows ColumnD= CDbl(gsDataA(iPsColA, lRow))+ CDbl(gsDataA(iPsColB, lRow)) gsDataA(iPsColD, lRow)= CStr(ColumnD) Next lRow </code></pre> <p>Any help is greatly appreciated!!!</p> <p>My main sub is :</p> <pre><code>'#LibInclude "common procedures" Option Explicit Public Sub Main Dim gsDataA As Variant Dim glNumRows As Integer With gINTRules.GridData 'Put the grid data into a working string data array. gsDataA = .DataArray glNumRows = UBound(gsDataA, 2) 'Put the modified data array back into the input grid. .DataArray = gsDataA 'Success is True if there were no errors. gINTRules.Success = CBool(.ErrorCol = 0) End With End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload