View Full Version : Format Decimal Places in Code - Easy I'm sure!


Elana
09-27-2001, 03:42 PM
I need to determine a pro-rata factor using the following code:

Dim intNodays as Integer
Dim Factor As Single
intNoDays = DateDiff("d", Me.CovEffDate, Me.ExpDate)

Factor = intNoDays / 365

My problem is that I need field Factor to be limited to 3 decimal places. I've tried several things, but nothing seems to work. I'm sure I'm missing something EASY.

Any help is much appreciated!

R. Hicks
09-27-2001, 04:39 PM
Try:

Factor = Format(intNoDays / 365,"0.0##)

HTH
RDH

[This message has been edited by R. Hicks (edited 09-27-2001).]

Elana
09-27-2001, 10:06 PM
Thanks so much! I had tried Format previously, but I didn't have the syntax right.

R. Hicks
09-28-2001, 03:50 AM
You are welcome .... :-)

RDH