Date Spacing

Little_Man22

Registered User.
Local time
Today, 02:50
Joined
Jun 23, 2001
Messages
118
I am looking to space out a date so that it fits precisely within a certain area. Currenlty I have the string set to read:
"dd mm yyyy"
resulting in output that resembles the following:
19 02 1996

However, what I am aiming to do is space out the individual portions of the date as well, i.e.:
"d d m m y y y y"
So that the field will (hopefully) resemble the following:
1 9 0 2 1 9 9 6

Although it sounds easy I can't seen to find a feasible solution.

Any ideas?
 
here's a fxn:

Public Function PutSpaceInDate(dtDate As Date)

Dim strDate As String
Dim intLoop As Integer
Dim strSpaced As String

strDate = Format(dtDate, "ddmmyyyy")
For intLoop = 1 To Len(strDate)
strSpaced = strSpaced & (IIf(strSpaced = vbNullString, _
Mid$(strDate, intLoop, 1), " " & Mid$(strDate, intLoop, 1)))
Next

PutSpaceInDate = strSpaced

End Function
 
I tried your string as a public function within my module but it didn't seem to work...for instance the current record shows a date of 01 01 1998...I need this broken into 0 1 0 1 1 9 9 8...when I use your string I get the following: 1 1 1 1, etc...

It will not recognize the zero's.

p.s. if it means anything the field that I am trying to format is called 'LastUsed'.

Thanks again.
 
it's working on my copy. i tried different formats, even passing the parameter as string. are you sure?
 
I tried just cutting and pasting your string yet it still wouldn't work.

I have the following in my module:
Case "LastUsed"strFieldValue = Format(Nz(rstClient!LastUsed, " "), "dd mm yyyy"). When I try to seperate the 'dd' (for a date of 01/01/2000) for instance, the new date reads 1 1 1 1...

Are there any other settings that I need to change in order for this public function to take effect?

Ryan.
 
try this:

Case "LastUsed"
strFieldValue = PutSpaceInDate(Nz(rstClient!LastUsed, Date()))
 
It works perfectly
smile.gif


Thanks for all of your help...I really appreciate it.

Ryan.
 

Users who are viewing this thread

Back
Top Bottom