My Assistant
![]() ![]() |
|
|
Oct 13 2011, 10:54 AM
Post
#21
|
|
|
UtterAccess Ruler Posts: 4,254 From: Downey, CA |
I'm actually doing this at work, and can't watch YouTube videos
here is the 'magic' code to get the date - I first (in code) make a copy called MyFilename_Copy ren C:\MyFilename_Copy.accdb MyFilename_Copy_%date:~6,4%_%date:~0,2%_%date:~3,2%.accdb and for today Oct 13, it will give me a file named MyFilename_Copy_2011_10_13.accdb |
|
|
|
Oct 13 2011, 11:03 AM
Post
#22
|
|
|
Access Wiki and Forums Moderator Posts: 48,599 From: SoCal, USA |
Hi,
Glad to hear you got it to work. You must have a different system because in my WinXP machine, that code came out as: MyFilename_Copy_/13/_Th_ 1.accdb I wonder if it has anything to do with Regional Settings? Anyways... Good luck with your project. |
|
|
|
Oct 13 2011, 04:11 PM
Post
#23
|
|
|
UtterAccess Ruler Posts: 4,254 From: Downey, CA |
Hi, Glad to hear you got it to work. You must have a different system because in my WinXP machine, that code came out as: MyFilename_Copy_/13/_Th_ 1.accdb I wonder if it has anything to do with Regional Settings? Very possibly - mine are not the standard default - I think they are YYYY_MM_DD, not sure - but it's not the 'canned' default Interesting about the th guess that's the first two char in the day of the week, huh 'Th' as in 'Thursday' |
|
|
|
Oct 13 2011, 04:18 PM
Post
#24
|
|
|
Access Wiki and Forums Moderator Posts: 48,599 From: SoCal, USA |
Hi,
Yes. For today's date, I get the following result on my machine: H:\>echo %date% Thu 10/13/2011 Which is why your first posted code on this technique worked for me. That is, using the starting positions: 4, 7, and 10. Cheers (IMG:style_emoticons/default/cheers.gif) |
|
|
|
Oct 13 2011, 04:22 PM
Post
#25
|
|
|
UtterAccess Ruler Posts: 4,254 From: Downey, CA |
Hi, Yes. For today's date, I get the following result on my machine: H:\>echo %date% Thu 10/13/2011 Wow, I'm surprised all this takes so little coding - or CAN take so little - hey, did you see my post on setting myself up as administrator for running tasks in scheduler ? Go there now ! Thanks ! (IMG:style_emoticons/default/cool.gif) |
|
|
|
Oct 13 2011, 04:24 PM
Post
#26
|
|
|
Access Wiki and Forums Moderator Posts: 48,599 From: SoCal, USA |
Hi,
Wow, I'm surprised all this takes so little coding - or CAN take so little - Me too! Thanks for sharing your find. QUOTE hey, did you see my post on setting myself up as administrator for running tasks in scheduler ? Go there now ! Thanks ! (IMG:style_emoticons/default/cool.gif) Just did... And posted a comment too! (IMG:style_emoticons/default/wink.gif) |
|
|
|
Jan 30 2012, 08:30 PM
Post
#27
|
|
|
UtterAccess Ruler Posts: 4,254 From: Downey, CA |
Hi, Do you mean the YouTube video I showed you didn't help? Basically, you copy and paste Moo's code into a Text file using Notepad. But when you save it, give it a .vbs extension. You can then double-click on that file or execute it in the Task Scheduler like Moo did. Hope that helps... I got it to work, now it doesn't work with Win 7 |
|
|
|
Jan 30 2012, 10:33 PM
Post
#28
|
|
|
Access Wiki and Forums Moderator Posts: 48,599 From: SoCal, USA |
I got it to work, now it doesn't work with Win 7 Sorry to hear that. I will go back to my original suggestion and recommend VB scripting instead of batch files. Just my 2 cents... (IMG:style_emoticons/default/2cents.gif) |
|
|
|
Feb 8 2012, 10:58 AM
Post
#29
|
|
|
UtterAccess Ruler Posts: 4,254 From: Downey, CA |
Solved the problem - here is the code that works in Win7:
My ProjectTracker.mdb resides in my “Documents” folder – formerly known as MyDocuments in prior MS versions before WIN7 There are other files I copy, but I’m just showing you the one file to avoid clutter I have a sub-folder on the P:drive mapped as S: drive – from there, I have an Archive_2012 folder This script copies my ProjectTracker, then renames it with the current date at then end CODE copy Y:\Franchise_Fees\2012\FranFee_Db_2012.accdb s:\Archive_2012\FranFee_Db_2012_Copy.accdb REM ren S:\Archive_2012\FranFee_Db_2012_Copy.accdb FranFee_Db_2012_Copy_%date:~10,4%_%date:~4,2%_%date:~7,2%.accdb .... so today Feb 8th, it would rename it ProjectTracker_2012_02_08.mdb in the network drive |
|
|
|
Feb 8 2012, 11:03 AM
Post
#30
|
|
|
Access Wiki and Forums Moderator Posts: 48,599 From: SoCal, USA |
Hi Steve,
Thanks for the update. Glad to hear you got it sorted out. Cheers, DBG |
|
|
|
Feb 8 2012, 11:09 AM
Post
#31
|
|
|
UtterAccess Ruler Posts: 4,254 From: Downey, CA |
|
|
|
|
Feb 8 2012, 11:16 AM
Post
#32
|
|
|
Access Wiki and Forums Moderator Posts: 48,599 From: SoCal, USA |
DBG, Actually, I should have taken your comment from Oct 13 more serious 'cause that's EXACTLY what the problem was !!! Wow! That's good to know. (IMG:style_emoticons/default/thanks.gif) (I just get lucky sometimes.) (IMG:style_emoticons/default/grin.gif) |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th June 2013 - 04:19 AM |