Link to home
Start Free TrialLog in
Avatar of Mahonek
Mahonek

asked on

Updating Percent Field Using VBA Calculation

I am trying to add a new record to a table (rcFTDSb [recordset]). The field being updated has a datatype of number and format of percent and decimal of Auto.  The variable <Vr1wpct> is calculating correctly, but the table field <![r1wpct]> is still showing 0 only.  Any answer on how I can get the table field <![r1wpct]> to show the result of the variable <Vr1wpct> which in my test is .50.  Thanks.

Here is a sampling of the relevant code:

Dim w1 As Integer
Dim r1 As Integer
Dim Vr1wpct As Variant
Dim rcFTDSb As Recordset
Dim rcEndB As Recordset


w1 = 0
r1=0
Vr1wpct = 0

If rcFTDSb!race = 1 And rcFTDSb!win > (CCur(0)) Then
    w1 = w1 + 1
End If

If r1 >= 1 Then
        Vr1wpct = w1 / r1 ‘should be <.50 = 5 / 10> this is working fine
End If


rcEndB.AddNew
        With rcEndB
            ![r1wpct] = Vr1wpct ‘<0 = .50> ‘problem. The field is not recognizing .50      
        End With
rcEndB.Update
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial