Link to home
Start Free TrialLog in
Avatar of Karen Schaefer
Karen SchaeferFlag for United States of America

asked on

Format Percent within a Variable in VBA

Need to compare 2 values that are formatted on the query/table as Percent.

However, when I compare the values as variables in vba they revert back to a number.

example:

.33398....  Need to compare as 33.00% and 5.00%
.05

what do I need to do, I tried various formats without success.
format rs.fields(nTierno).value

as
Format(rs.fields(NTierNo).value), Percent, 2 decimal places....
                       If nfld < rs.Fields(nTierNo).Value Then
                            Debug.Print "nTierVal:" & rs.Fields(nTierNo).Value
                           Debug.Print rs.Fields("TotalNetUSExp").Value
                           Debug.Print rs1.Fields(strfld).Value
                           nOvrAmt = 0
                           BkOvrCalc = nOvrAmt
                           GoTo cont:

Open in new window


K
ASKER CERTIFIED SOLUTION
Avatar of Graham Mandeno
Graham Mandeno
Flag of New Zealand 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
Avatar of Karen Schaefer

ASKER

thanks.