Need to remove "/" from a date programatically.

W

Weeble

I am trying to automate exporting a couple of reports to Excell. The output
file name will be the recipients initials, i.e. DZ with the date of the
export appended to it. DZ122909 I can get the date from a date control on the
form initiating the Sub, but I can find nothing on how to find and remove
characters from a string. Is this possible with Access and can you point me
in the right direction?

Thanks,
 
C

Clifford Bass via AccessMonster.com

Hi,

You can use the Format() function.

? Format(#12/29/2009#, "mmddyy")
122909
? Format(#12/29/2009#, "yyyymmdd")
20091229
? Format(#12/29/2009#, "yymmdd")
091229

I would suggest you use the second or third one instead of the first so
that the files for each recipient will sort correctly by date. Even if it is
not an issue for you should you not keep them, the recipients may. And it
will be a big help to them when it comes time to find a particular file.

Have you contemplated what you will do when you have two recipients with
the same initials?

Clifford Bass
 
W

Weeble

Thanks to both of you for your help.

Clifford,

I haven't had that issue yet, but I can resolve that by including a company
identifier or even a department identifier if it comes to that. But thanks
for thinking of that, I would rather address it now than wait for it to bite
me in the Format(A_ _, "_ SS").
 
C

Clifford Bass via AccessMonster.com

Hi,

You are welcome! Do note that even a company and/or department
identifier will not guarantee uniqueness. Sam Smith could work in the same
department of the same company as his brother Simon Smith.

Clifford Bass
 

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