Revisit Need to remove "/" from date?

  • Thread starter Thread starter Weeble
  • Start date Start date
W

Weeble

I said your sugestion worked, but I hadn't tried them. I can't get them to
work. I tried applying them to the form control as well as the sub. I get
some unusual dates and the "/" are still there.

Perhaps you could tell me where to use the Format() function to make this
work.

Again, Thanks.
 
Show us the code where you take the initials and add the date (as you now do
it that has the / characters)

Then we can tell you where to apply the format function
 
strDate = Me.DateControl.Value
strDate = Format(strDate,"mmddyy")

strPath1 = "C:\Documents and Settings\mjonkman\My Documents\Daily Logs"
strPath1 = strPath1 & "\" & strYear & "\" & strMonth
strPath1 = strPath1 & "\DZ" & strDate & ".xls"

Note that strYear and strMonth are not dates but refer to sub directories in
the Daily Logs directory.
 
It should work as you show it here. I suspect that you strDate doesn't
contain what you think it does

Go to VB screen and immediate mode and try a couple of dates to see how the
format works

try
print format(date(),"yyyymmdd")
print format ("12/29/09,"yyyymmdd")
etc to see what results the formater gives you

or you can add lines to your code

debug.print strDate
debug.print format(strdate,"yyyymmdd")

Run your code and then look in the immedate area of the vba window to see
what was printed
 
I tried applying them to the form control as well as the sub.
What do you mean by 'sub.'
Your orignal says you were exporting report to Excel. Did you try using the
Format function in the query that feeds the report?
 
Karl,

Actually I misspoke myself. I am exporting the Query to Excell. Sorry for
the confusion.

I will try working with the code in my sub. If you see anything that I am
doing wrong, please advise.

Thanks,
 
Thanks for the direction. I will try working with this and see where it takes
me. The Immediate mode is new to me so that will take a little research. I'll
post back if I just can't figure it out.

I did create a work around that is more labor intensive for the operator,
but this kind of defeats the point of automating processes.

Again, Thanks.
 
I found my problem. The date control I was referencing was in a page header
on the form. I had intended to create a form header but created the former in
my hurry. Why my sub wouldn't read the date properly from the page header is
a mystery to me, but once I put the date control in a form header it reads
fine and formats perfectly.

Thanks to everyone.
 
Back
Top