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

VB code doesn't work anymore after office update

P: 3
Hello

I've updated recently an access database from Office 97 to office 2007. But somehow the events are broken now. Usually I could enter into a field how many kilometers I've driven with my car and after hitting the "save"-button, it would show me in another field how many money I've spent for it. The code is this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Befehl12_Click()
  2. On Error GoTo Err_Befehl12_Click
  3.  
  4.     Me.Haben.Value = Me.Text14.Value * 0.6
  5.  
  6.  
  7.     DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  8.     Me.Kombinationsfeld10.Requery
  9.  
  10. Exit_Befehl12_Click:
  11.     Exit Sub
  12.  
  13. Err_Befehl12_Click:
  14.     MsgBox Err.Description
  15.     Resume Exit_Befehl12_Click
  16.  
  17. End Sub
My problem is, that just nothing happens. I tried to add a MsgBox in the beginning of the code but also nothing happened. So I guess there is a problem with the event handling; the code isn't compiled at all. Did the VB code to execute something change? Or what is wrong with this code? It worked always until I've updated...

Thanks a lot!
Feb 16 '14 #1

✓ answered by zmbd

Often the default security setting is changed to disable all macros/vba

Take a look at export-access-form-ppt Post 36
Even though this is for power point, the same will apply for all Office2007/2010. Find the option to alter the ribbon on the back stage, add the developer tab, and the follow the remaining instructions.

If this doesn't fix your issue, then you will have to do a FULL uninstall and re-install of the entire office program.

Share this Question
Share on Google+
10 Replies


zmbd
Expert Mod 5K+
P: 5,397
Often the default security setting is changed to disable all macros/vba

Take a look at export-access-form-ppt Post 36
Even though this is for power point, the same will apply for all Office2007/2010. Find the option to alter the ribbon on the back stage, add the developer tab, and the follow the remaining instructions.

If this doesn't fix your issue, then you will have to do a FULL uninstall and re-install of the entire office program.
Feb 16 '14 #2

P: 3
Thanks, it was really this. I had to change security settings for macros and now it works perfectly fine :)
Feb 16 '14 #3

NeoPa
Expert Mod 15k+
P: 31,768
A viable alternative to moving your projects from a non-trusted location to a trusted one, is simply to add the location they are currently in to the list of trusted locations. Obviously, only do this if where they are in a trustable place. The temp folder where email attachments are loaded up into would not be such a trustable location.

I seem to recall there should be something (somewhere) that allows you to "Trust access to current project". I couldn't find it, but if you come across it then it should be checked.

Since reviewing this properly - See later comments - I've remembered that it is something I often need to set to True, but something which should only be set to True for those who know they need it. Developers generally (and not even all of those), or those who have been told to do so by their developer whom they trust fully. In practice this means very few people ever need this set to True, and those who do will probably know that without me telling them.

Be careful with this option. It can be dangerous.
Feb 16 '14 #4

zmbd
Expert Mod 5K+
P: 5,397
NeoPa,
In Office2010, a document that doesn't fall under one of the protected view scenarios (see the link in my last post) will often prompt you to add the current document to a list of "Trusted Documents," this may hold true for Office2007.

I tend to never do this when prompted:
- If I want to trust the document then I move it to a trusted location.
- In the trust center, it is an all or nothing list, at least in Office 2010. That is to say if one trusts X.docm and Y.PPTM and z.xlsm and then you decide that you don't want to turst X.docm, then you have to clear *.docm from the trust center and I've found when performing that action the Y.PPTM and Z.XLSM are also removed without warning.
Feb 16 '14 #5

NeoPa
Expert Mod 15k+
P: 31,768
Indeed Z.

My comment was about deciding trusted locations rather than trusting individual documents.

Clearly, don't trust a location unless you trust it and know that anything put there will be trusted. Don't just trust a location because you want to see what's in a particular document. In such a case you may move it to a trusted location temporarily. That wasn't the scenario my comment covered.

If you have a setup with very limited folders are set as trusted then moving everything to these folders may not make good sense. That would be a case of the tail wagging the dog. Make conscious decisions about which folders you wish to trust. Then when you've saved a document into any of these they will run by default.
Feb 16 '14 #6

zmbd
Expert Mod 5K+
P: 5,397
Sorry NeoPa, I should have been more clear, m reply was directly to, with the intent to elucidate-upon:
I seem to recall there should be something (somewhere) that allows you to "Trust access to current project". I couldn't find it, but if you come across it then it should be checked.
(^_^)
Most certainly I agree with the remainder of your post and the subsequent follow-up
Feb 16 '14 #7

NeoPa
Expert Mod 15k+
P: 31,768
Ah. I get you. Except I'm not sure we understand this feature in the same way. It would help if I could actually find it of course.

My understanding is that it refers to a different level of trust than simply allowing the project to open. I may be mistaken, but I thought it was necessary for all projects to have this set - as it's an application setting rather than one which is per project.

I'd read up more on it if only I could find the little bu..er again :->
Feb 16 '14 #8

NeoPa
Expert Mod 15k+
P: 31,768
Just to clarify - I found a reference to it in Enable or disable macros in Office documents.

It is used specifically to allow modify access to the VBA code. IE. With this set the code of the project is allowed to manipulate the code of the project and anything related to the VBA IDE window. I expect that means both to read and update information. This is quite a different animal from simply trusting the code to run.

NB. It doesn't appear to be an option within MS Access. It is found in MS Excel and some other MS Office applications though.
Feb 16 '14 #9

zmbd
Expert Mod 5K+
P: 5,397
oh... that little nasty setting... IMHO, the average user should leave it unchecked and stay the (insert strong cussing here) away from it.

This is one thing that MS did seem to get absolutly correct in the security settings by disabling this option on default. Often, this is where the malicious code (a POC type being ethan-fome) would get into the vba system and start writing itself into all of the templates and new documents.
Feb 17 '14 #10

NeoPa
Expert Mod 15k+
P: 31,768
I've updated my earlier comment to reflect my current understanding. I'm afraid I posted earlier without remembering it clearly enough. Thanks for your prompting Z.
Feb 17 '14 #11

Post your reply

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