469,927 Members | 1,454 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Save using Current Date and Current user profile

Hi hope some one can help I have 2 questions:-

Question 1) When saving a file in access to excel how do I specify current date

Question2) When saving a file in access to excel how do I specify current user profile

To be more specific I have a Macro in MS Access and I have selected Action "Output to"

The Output file is currently set to:-

C:\Documents and Settings\Fitzgem4\Desktop\CadburyData_Date

I want to replace Fitzgem4 with Current User and Date with Todays Date

The output format is set to Excel

I am intending to attach the Macro to a button any ideas how I can do this?

Best Regards

Matt Fitzgerald
Feb 1 '08 #1
2 2856
446 Expert 256MB
Hi Matt
I don't understand exactly what you mean by user profile. If you mean Windows Username then the attached utility will find it and put it into a string called "Username", that you can use.

If you want something out of the Access workgroup file then someone else will have to help.

To get the date just setup a string, set it to current date then concatonate with the Username string from the attached module. eg
Expand|Select|Wrap|Line Numbers
  1.  Dim strDate as String 
  2. Dim strFileName as String
  4. strDate = Format(Date,"ddmmmyy") 'or whatever is your prefered format
  6. strFileName = Username & "_" & strDate
  8. 'Output file = C:\Documents and Settings\Fitzgem4\Desktop\strFileName 
I would not use a macro, just write the code into the On_Click event procedure of the button.

Hope this helps

Attached Files
File Type: zip Username2000.zip (18.4 KB, 176 views)
Feb 1 '08 #2
Thank you I did mean username and I now have it working
Feb 13 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Nikhil Tayal | last post: by
1 post views Thread by VictorG | last post: by
2 posts views Thread by Nick | last post: by
reply views Thread by shapper | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.