Mark Pelletier
Mark Pelletier

Reputation: 1359

Number Format: 1.0 = "0000100000"

I have a task to deliver a numeric/decimal value as part of a fixed length text file. These values will take the following form:

10 chars, w/last 5 chars representing the decimal portion of the string. These will all be positive numbers.

A few examples:

0.123 = "0000012300" 1.0 = "0000100000" 123.456 = "0012345600" 234 = "0023400000"

The numeric data resides in an Access database formatted as numbers (double).

My current thought is:

  1. Retain the orignal numeric data in one table
  2. Convert to TEXT strings via query, save to a second table
  3. Export to a fixed width flat file using MSAccess export function

Can anyone suggest a reasonable approach to produce the necessary 10 character TEXT conversion?

Thanks!

Upvotes: 1

Views: 97

Answers (1)

Gord Thompson
Gord Thompson

Reputation: 123799

Perhaps just multiply by 100000 and format?

Format(x * 100000, "0000000000")

Upvotes: 3

Related Questions