let me have a look at you db and get back to youRun as Administrator is an option when you right click on various programs. Most of the time it isn't needed in Access. However, it provides elevated permissions to do things using VBA like editing the HKLM hive of the registry, change the system date/time etc.
Try running the ChangeClockDate or ChangeClockTime procedures (or do both together using ChangeSystemClockDateTime) using the updated file I've attached here.
First of all try to do so with Access opened normally. You will get error 70 - permission denied.
Repeat with Access using Run As Administrator. Those procedures will then work. Use ResetSystemClockDateTime to reverse the changes
OK, I just ran the change and reset, no issues?
I actually tested the Date and Time in the immediate window yesterday, and I use the Access icon on the task bar.
I just checked my MSACCESS.exe and owner is system. I cannot see anything different on the shortcuts on the start menu either.?
Nice code as well, that should help a few people![]()
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Forgot to mention this previously.
More recent versions such as A365 include Run As Administrator as part of the default context menu.
For earlier versions, there are at least 5 ways of adding the Run As Administrator option
1 For A2010/2013, hold the shift key down whilst you right click the Access shortcut to add the Run As Administrator option
For A2007, the same action adds Run As ... to the context menu. Click Administrator and add the password for the Windows Admin account.
2. Alternatively, you can right click on the MSACCESS.EXE program file itself in Windows File Explorer
3. Make your own Access desktop shortcut from the program file. It will include Run As ...
4. Make your own Access desktop shortcut from the program file. Click the Advanced button on the shortcut and tick Run As Administrator
5. Using Windows 10 (Pro only??), you can use the Access shortcut in the Start menu instead. That includes Run As... under the More section.
This isn't possible in Windows 7
IIRC correctly, you can also do this by editing the registry but I can't remember the precise details offhand
Hope that's of use to some of you....
EDIT
Using Run as Administrator with A2010 onwards, the code to change/reset the system clock works perfectly
However using A2007 on a VM:
When I tried using the code to change the system date/time as a standard user, the code ran but the system clock didn't change.
Using Run As Admin, the clock changed...and then changed back almost immediately.
Last edited by isladogs; 06-28-2021 at 03:45 PM.