By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,211 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,211 IT Pros & Developers. It's quick & easy.

Save using Current Date and Current user profile

P: 30
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
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 446
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 (18.4 KB, 149 views)
Feb 1 '08 #2

P: 30
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.