Results 1 to 2 of 2

Thread: format()

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 1999
    Location
    St. Louis, MO USA
    Posts
    21

    Post

    I am using the format function. I need to have a defined amount of characters. For instance it may read in the number 15 however the field is 7 characters long so it needs to write to a file with leading 0's. Also how do you read in decimal numbers (e.g. 3.6) and make it write to a file as 36.

    Any suggestions?

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    when saving your values just pad them yourself, eg.

    sSaveString = Right("0000000" & Str(iValue), 7) 'e.g., iValue = 15, would result in sSaveString = "0000015"

    As for the Decimal Values, Multiply the Value by 10^(No. of Decimal Places), eg.

    3.6 * 10 = 36
    3.25 * 100 = 325
    etc..


    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width