Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trimming zeros of text fields

Status
Not open for further replies.

EddyLLC

Technical User
Mar 15, 2005
304
0
0
US
I am trying to compare two numbers one is in recordset which is represented as Rate1 below. The second is in an text file I open and is represented by the "str1" string. Rate1 equals 0.029928 while the number in str1 equals .029928. The numbers are the same technically but the statement returns a False. Is there a method to trim the left zero off if it is a zero? I may be another number.

ElseIf LTrim(rst("Rate1")) = Format(Mid(str1, 15, 7) / 1000000, "!&&&&&&&")
 
I would try to convert the string to a number data type, Single, more specifically(or whatever data type Rate1 is). Then, make your comparison.

Dim sng1 As Single

sng1 = CSng(str1)

...ElseIf rst!Rate1 = sng1

 
Have you looked at parse?

Hope this gets you closer to the solution.

Andrew
a.k.a. Dark Helmet

"What's the matter Colonel Sandurz? Chicken?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top