mainrotor

asked on

# I need help formatting values in VB6

HiExperts,

I need help formatting some field values in VB6. I need the following:

Any currency value in this format: -#########.##

Any date value in this format: MM/DD/YYYY

Any numeric value in this format: ###########

Any phone value in this format: (Exactly 10 digits for example (123) 456-7890 would become 1234567890)

Any SSN value in this format: (Exactly 9 digits for example 111-22-3333 would become 111223333)

Any TIME value in one of these 2 formats: HH:MM[:SS] for any 24 hour time for example 1345 would become 13:45:00

HH:MM[:SS] AM/PM for any 12 hour time for example 1:45 would become 01:45:00PM

Thanks in advance for all of your help,

mrotor

I need help formatting some field values in VB6. I need the following:

Any currency value in this format: -#########.##

Any date value in this format: MM/DD/YYYY

Any numeric value in this format: ###########

Any phone value in this format: (Exactly 10 digits for example (123) 456-7890 would become 1234567890)

Any SSN value in this format: (Exactly 9 digits for example 111-22-3333 would become 111223333)

Any TIME value in one of these 2 formats: HH:MM[:SS] for any 24 hour time for example 1345 would become 13:45:00

HH:MM[:SS] AM/PM for any 12 hour time for example 1:45 would become 01:45:00PM

Thanks in advance for all of your help,

mrotor

ASKER

The fields are in an array

This is what my code looks like as I loop through the array:

strRecord = strRecord & "," & Trim$(Replace(tblEmployee.Extract(6, 1, 1), ",", "''"))

This is what my code looks like as I loop through the array:

strRecord = strRecord & "," & Trim$(Replace(tblEmployee.

Have you looked at the Format() function? It is well documented in the MSDN Help that comes with VB6.

If you can't find that, the VBA version of the function is the same and the Microsoft reference can still be found on line here:

http://msdn.microsoft.com/EN-US/library/office/gg251755.aspx

If, after trying, you have a problem with any specific format target, let us know.

If you can't find that, the VBA version of the function is the same and the Microsoft reference can still be found on line here:

http://msdn.microsoft.com/EN-US/library/office/gg251755.aspx

If, after trying, you have a problem with any specific format target, let us know.

Which columns/indexes contain what kind of data?

Please take a second look at your TIME specification. These two examples do not align with each other or prior (data type) examples.

Please take a second look at your TIME specification. These two examples do not align with each other or prior (data type) examples.

ASKER CERTIFIED SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**
2. Where does this formatting take place?