FormatPercent Mismatch problem

MaliciousMike

Registered User.
Local time
Today, 22:51
Joined
May 24, 2006
Messages
118
I'm tearing my hair out here.

Code:
Public Function IsThereEnoughNumbers() As Boolean

Dim Percent1 As Integer
Dim Percent2 As Integer
Dim PercentResult As Integer
Dim Percent3 As Integer

        IsThereEnoughNumbers = False
        Percent1 = DCount("[company name]", "tmp_sheet")
        Percent2 = DCount("[company name]", "qryHybrid90")
        Percent3 = Percent2 / Percent1
[B][COLOR="Red"]        PercentResult = FormatPercent(Percent3, 2)[/COLOR][/B]
            If PercentResult < 0.1 Then
                MsgBox "This Hybrid client has " & PercentResult & ", which is less than 90% telephone numbers", vbOKOnly, "Problems importing"
                IsThereEnoughNumbers = True
                Exit Function
            End If
End Function


It's telling me i have a "type mismatch" in my format.
What the hell am i doing wrong? I'm really getting stressed out here. I'm beyond this!
 
Of course you do - FormatPercent returns string.
 
ok... dimmed it as string.

The other error i'm having is that Percent3 is returning 0.

In my test data:
percent2 is 24
percent1 is 78

Percent3 should return 0.31 (to 2dp)

Why is that happening?
 
Thanks for the help.. with your info and a few tweaks i got it sorted!

Thanks!
 

Users who are viewing this thread

Back
Top Bottom