VBA code not working (1 Viewer)

isladogs

MVP / VIP
Local time
Today, 05:23
Joined
Jan 14, 2017
Messages
18,209
I will ask Uncle@The_Doc_Man to delete the topic permanently hahaha
I'll give a serious answer to that point - threads with answers should never be deleted otherwise everyone who participated has wasted their time & the info is not available for other users.

Let me try asking for a 4th time. Did you open Access as an administrator and were you able to edit the HKCR registry hive?
 

azhar2006

Registered User.
Local time
Yesterday, 21:23
Joined
Feb 8, 2012
Messages
202
I'll give a serious answer to that point - threads with answers should never be deleted otherwise everyone who participated has wasted their time & the info is not available for other users.

Let me try asking for a 4th time. Did you open Access as an administrator and were you able to edit the HKCR registry hive?
No, I did not open Access as administrator or edit the HKCR registry hive. Frankly, I don't know how to edit the HKCR registry hive
 

Gasman

Enthusiastic Amateur
Local time
Today, 05:23
Joined
Sep 21, 2011
Messages
14,238
BTW - do use a different registry key value in the ral db just in case one of your end users ever reads this thread : OK @isladogs ;) :ROFLMAO:

I will ask UncleThe_Doc_Man to delete the topic permanently hahaha
You seem handy enough, doing that yourself? :(
 

azhar2006

Registered User.
Local time
Yesterday, 21:23
Joined
Feb 8, 2012
Messages
202
You seem handy enough, doing that yourself? :(
Do not delete posts. But I deleted a code that could be dangerous to the registry file. Someone from the members might try it and thus destroy their computer system
Perhaps someone else thought of protecting his database through many things. But I think that you and many friends here in the forum have to protect the database on two levels. The first is the hackers’ attempt to break the database, and the second level is that this intruder destroys the database himself and cannot take advantage of it. Like the military forces, when they have a military machine left on the battlefield, the pilot comes and destroys this machine with a projectile that costs more than the machine itself, and the reason is so as not to steal the technology of that machine. I think the location of the registry will make the intruder unaware of what he is tampering with.
I am not a first-class programmer and I also did not reach your levels of programming. You are really amazing. But this is my idea of safety (safety and then destruction)

Gasman 🌷 🌺

 
Last edited:

isladogs

MVP / VIP
Local time
Today, 05:23
Joined
Jan 14, 2017
Messages
18,209
Better not to post code that might be dangerous in the first place...!

No, I did not open Access as administrator or edit the HKCR registry hive. Frankly, I don't know how to edit the HKCR registry hive
Then why on earth didn't you say so earlier. I've been banging on about this repeatedly since post #10 and failing to get any response.
I purposely uploaded an app which is only fully functional when Access is run as an administrator.
Doing this gives elevated privileges e.g. to edit the HKLM hive of the registry (with CARE!)

Right click on the Access icon on the desktop and click as Run As Administrator option
1638906350058.png

Or right click on the Start menu Access icon then look in the More ... section.

NOTE:
1. If you can't see that option (e.g. in A2010), hold the shift key down then proceed as above.
2. Any registry changes you make by doing this are entirely at your own risk. However, my app I mentioned in post #20 is totally safe!
 

azhar2006

Registered User.
Local time
Yesterday, 21:23
Joined
Feb 8, 2012
Messages
202
Better not to post code that might be dangerous in the first place...!


Then why on earth didn't you say so earlier. I've been banging on about this repeatedly since post #10 and failing to get any response.
I purposely uploaded an app which is only fully functional when Access is run as an administrator.
Doing this gives elevated privileges e.g. to edit the HKLM hive of the registry (with CARE!)

Right click on the Access icon on the desktop and click as Run As Administrator option
View attachment 96629
Or right click on the Start menu Access icon then look in the More ... section.

NOTE:
1. If you can't see that option (e.g. in A2010), hold the shift key down then proceed as above.
2. Any registry changes you make by doing this are entirely at your own risk. However, my app I mentioned in post #20 is totally safe!
Yes, I now understand what you mean by opening Access as an administrator. Yes, this option does not appear to me when I click the right mouse button. I also know the work of the shift key. But I don't see the option to open Access as administrator

Now I understand what you mean:):rolleyes:
 

Attachments

  • 222.png
    222.png
    86.2 KB · Views: 61
Last edited:

isladogs

MVP / VIP
Local time
Today, 05:23
Joined
Jan 14, 2017
Messages
18,209
Using A2007, hold down Shift, right click the Access icon and select Run As...t

1638912793813.png


..then click ...The following user ... and select Administrator

1638912605371.png
 

azhar2006

Registered User.
Local time
Yesterday, 21:23
Joined
Feb 8, 2012
Messages
202
I have no problem about editing the registry using my own code ...
Sorry but I'm not prepared to test your code in case it causes problems and I don't have time to spend fixing issues on my PC

Did you understand my comments in post #10?
You are trying to write to the HKEY_CLASSES_ROOT hive (which I really wouldn't recommend).
In order for that to have any chance of working, Access MUST be run as an administrator i.e. with elevated privileges.
Did you do that?

I have an example app which writes to the HKLM hive and therefore also requires Access to be run as an administrator.
JET ShowPlan Manager - Mendip Data Systems (isladogs.co.uk)

Its not the latest version of the app but the registry part of the code is identical.

EDIT:
One quick point. In your code in e.g. post #19, should there be a backslash before \light
You are wonderful isladogs
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 23:23
Joined
Feb 28, 2001
Messages
27,148
Since this thread seems to be at a point of favorable resolution, I will not delete it despite the earlier comments.

By the way, other than permissions issues (since the registry hives are in separate files, they can have separate permissions), editing one hive is just like editing any other hive. Same procedures, really. BUT ... if you screw up, you break it and it might not be easily fixable if you don't have a system backup or other recovery medium.
 

isladogs

MVP / VIP
Local time
Today, 05:23
Joined
Jan 14, 2017
Messages
18,209
Since this thread seems to be at a point of favorable resolution, I will not delete it despite the earlier comments.

By the way, other than permissions issues (since the registry hives are in separate files, they can have separate permissions), editing one hive is just like editing any other hive. Same procedures, really. BUT ... if you screw up, you break it and it might not be easily fixable if you don't have a system backup or other recovery medium.
Just to clarify part of the above....
Assuming users have administrator status, they can edit any of the hives using Regedit as that is always run as an administrator.

However from e.g. Access, only the HKCU hive is normally editable (and for good reason). To edit the other hives from within Access requires elevated privileges which means Access has to be opened using the Run As Administrator option....and great care should be taken for the reasons stated.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 23:23
Joined
Feb 28, 2001
Messages
27,148
Fine point noted regarding running RegEdit directly.
 

Users who are viewing this thread

Top Bottom