Make 1 field into 2

K

Karin

Hi,
I have a single table with IDClient (which is primary key), it has decimal
points up to 5. I want to take the decimals and move them into their own
field named IDEng.
If the decimal is 0, I need a 0. I'm drawing a complete blank. It might
be best to end up with and extra field: IDClient (remains unchanged),
IDClient2 (has main numbers) and IDEng (has decimals) (just in case I screw
up). TIA!
 
K

Keven Denen

Hi,
I have a single table with IDClient (which is primary key), it has decimal
points up to 5.  I want to take the decimals and move them into their own
field named IDEng.
If the decimal is 0, I need a 0.  I'm drawing a complete blank.   It might
be best to end up with and extra field: IDClient (remains unchanged),
IDClient2 (has main numbers) and IDEng (has decimals) (just in case I screw
up). TIA!

You can use the Fix function to get the whole number portion.

Fix(9.553) = 9

So if you subtract that from your original number, you'll have the
decimal portion.

v = 9.553
whole = Fix(v) ' = 9
decimal = v - Fix(v) ' = .553

Keven Denen
 
K

Keven Denen

You can use the Fix function to get the whole number portion.

Fix(9.553) = 9

So if you subtract that from your original number, you'll have the
decimal portion.

v = 9.553
whole = Fix(v)  ' = 9
decimal = v - Fix(v) ' = .553

Keven Denen

Ooo...one potential issue. You'll probably want to convert the fix(v)
to a decimal to avoid round off errors.

decimal = v - CDec(Fix(v))

Keven Denen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top