Changing form name causes error message "Error accessing the system registry" - vba

I am programming the On_Click method for the button labeled "View" in the first printscreen below. The method will load a form with data corresponding with the specific address id in the row containing the "View" button. This code worked perfectly when pointing to a target form called "Addresses". However, when I decided to rename the form "Address", I started receiving the following error message when clicking on the view button:
I did some research on the web about this error message, which lead me to try to delete any outdated references in the VBA editor. But when I clicked on Tools-->References in the VBA editor, I got the following error message:
It seems that MS Access' entries in the system registry might have been corrupted. But I am not certain of this because the documentation of this on the web is sparse and inconsistent.
Here is a link to the database on a file sharing site: http://jmp.sh/b/9Uyx6J2YzWbs8zPq2h6g
If the problem is in the database, you can recreate the problem by opening the form "Main" and clicking on the button "View" for the record shown in the printscreen above, or for other records.
Can anyone show me how to get past this error message?

my advices?
You could rename your Forms!....SourceObject to "Address" instead of "Addresses"
You could copy/paste the form, delete the original, and retry
You could install a decent debugging tool like MZ-Tools for VBA, that will help you manage your errors. Check the details here
EDIT: I used to get similar bugs years ago, when I was writing specific form event procedures. As we decided to switch to a model where forms did not need to be debbuged anymore (check this here), we stopped getting this kind of message. And I think I forgot the trick we used to solve this kind of error. If I were you:
I'd try to open another access database and import all objects ...
I'd put aside/cancel the faulty onClick procedure
And I'd install MZ Tools because otherwise VBA debugging is a nightmare ...

Since access was not liking the command button in each record of the continuous form, I choose to put the view button's logic in the on click event of a text box in each row, which I configured as enabled but locked. This produces a separate link from each record of the continuous form to a unique detail page with more of the chosen record's data.
This solution works perfectly, and is enabling me to move on with my other coding.
However, it would be nice if someone else were able to show how to get the command button solution to work.

Related

Why would an Access 2010 form button with an embedded "openreport" macro and a "where" filter, stop working until I add a new button?

I decided to "tweak" an existing database to further manage multiple sources of income.
I copied the working database and created a "modification copy", just in case I messed things up horribly.
In the modified version, I have a button on a form (in fact, two different buttons with similar macro properties, just directed to do the same function to different reports.
The properties are your standard macro with an openreport, and a "where" condition.
Here's the problem. The macro has worked in the past, and continues to work on my "pre-modification" operating database.
On the modified database, after ensuring all the parameter elements are entered correctly, I can change the "view" to report view, and the macro seems to work just fine until I close the database.
As soon as I open the database, the buttons produce an error. See pic below.
The only way I seem to be able to resolve this odd button macro issue is by going into design view and adding a new button. I've discovered...I don't even need to embed a macro, just adding a new button seems to renew the macro operation...until I close and reopen the database. Then, I have to add a new button again to get the open database's macro to operate.
I can delete the new button added, and still have the macro buttons work, until I close and open the tweaked database.
I have zero VBA coding knowledge. I use Access's macro building tools and typically have to visit sites like this if I need to learn a new "trick" to get my database and it's various tools to do something.
I recently explored with the "subform" that can be seen above in the open form pic with the error message. My guess is that maybe that subform is somehow causing my macros to continuously fail???
Thanks for any help!

Write Conflict Error in Access Resolved Once After Saving Class Module

I have a form for viewing data in a table, which can open a pop up form to edit the data.
When data is edited in the pop up form, Access throws a write conflict error upon closing that form and returning to the original.
The strange behavior I'm experiencing is that when I make a change to the popup's class module in VBA, even if I immediately undo the change and save, the error will be resolved exactly once.
To be clear:
I make a change to the popup's class module in VBA (even a change I immediately undo and re-save)
I can open the pop up from my original form, edit records, then close the pop up. No error is thrown on closing the pop up.
I then open the pop up and edit records a second time. Then upon closing the pop up a write conflict error is displayed. This continues each subsequent time.
I now make a change to the popup's class module (again, even a trivial one), the error is resolved for one edit again, and the process repeats.
Does anybody know why this behavior could be occurring? Any help would be much appreciated.
Well the issue centers on if two users, or in this case two bits of code try to edit a record that is already dirty.
If the main form causes the record to become dirty (changed, but not saved), if then you run ANY other code that ALSO changes that data, then you get the conflict.
The simple solution then is to ALWAYS ensure that the the current forms record is safely tucked away and saved before you run + call code that might change that dirty record. And that includes that popup form + class.
So in your code that launches the form/class code? Do this RIGHT BEFORE you launch that 2nd form:
If me.Dirty = True then me.dirty = False
So, the above will safe write out the dirty record, and now you are free to launch/run any other code that might change that record. And because you run the above? Well, the record is not dirty anymore, and thus you should not see nor receive a write conflict error.
So adding a check to save if dirty before you launch/run that additional code/form will resolve this issue. In fact, as a habit, for just about "any" launching of additional UI forms, it a good idea to safe tuck away and save the current forms record when launching additional UI bits and parts.

Excel giving "System Error &H80004005 (-2147467259). Unspecified error" message

Everytime I load up my Excel document, it repeatedly shows up with the message from the title. The two options are OK and Help. help opens Office Help which is useless for anything. Clicking OK displays another message saying "Compile error: Out of memory." with OK and Help buttons. Clicking OK brings up VBEditor with no debug line selected and no macro popped up either for that matter. Eventually, after it repeats that and complains 20 (exaggeration) more times (I think that's due to having a lot of duplicate code for ActiveX controls on each sheet). It highlights the first line (the Sub declaration) of the code below.
Private Sub ComboBox4_Change()
Range("B3") = ActiveSheet.ComboBox4.text
End Sub
Now this is dealing with an ActiveX ComboBox. Opening a file from an earlier date will give no errors. It's like after a certain date, it just refuses to work with it. And get this, it's only happening on one computer. The files are saved on a network drive, which shouldn't be causing an error.
I'm almost 100% certain I found a solution to this issue. It may have caused issues for someone else 4 years ago, but it caused issues for me today and I wanted to contribute my answer for anyone else running into the same problem.
I had enabled an "Additional Control" in the Controls Toolbox for Windows Media Player. I think when it loaded in a video file, it overran the memory. This is when I started panicking (company computer and all) and Googling and came across this and a few other articles without a real, fast fix.
The hunch: Once that video file was attempted to be loaded in RAM memory (because that's how Userforms work) it locked up all the memory Excel would allow before throwing all the errors.
What I tried from other posts in various places: I rebooted a few times (before Googling, even). I tried the Quick Repair of Office from Add/Remove programs, that didn't work. (I'm using Office 2016.)
So, what worked? I had the idea that maybe I could disable all ActiveX from loading in my file, and Googled that. I got: https://support.office.com/en-us/article/enable-or-disable-activex-settings-in-office-files-f1303e08-a3f8-41c5-a17e-b0b8898743ed and proceeded to disable all ActiveX controls in Excel. I closed the file out. Can't recall if I closed Excel but I probably did.
Then I loaded up my file. (ActiveX is totally disabled at this time.) No errors! I went to VBA (ALT + F11), opened my UserForm, and the video I had inserted and could not remove was just... gone. I saved the file. I closed the file.
I opened Excel. I re-enabled ActiveX in the Trust Center. I opened my file. Still, no more video on my UserForm (I didn't need it anyway) and no "Unspecified" (memory) errors! And, I can save again!
I hope this solution persists... if not I've got some "splainin' " to do. So far, I'm designing and using the Userform, and saving the file, with no issues whatsoever. I think it worked!
I believe the problem was that I had a user form with an acrobat reader display control (like an iframe, but for PDFs). I didn't have this reference or control on that specific computer and it freaked out. Not 100% sure, but the problem no longer exists.
I have been having a very similar problem with WindowsMediaPlayer (WMP) ActiveX control that I have in a Form. Some computers with office 2016 are giving this error code (usless the help button), this is the first post I have found about something similar with WMP, and I found it after searching for this error on ActiveX controls...
So my solution was to go to VBA (alt+F11), right clic on form that has the activex control and then remove it witohout exporting.
The big problem is, that for me, this form is the most important part of the application.
I have no mor information, if I find something I'll come back to post feedback.
I encountered this issue when trying to pull data from an access database. The query I was trying to pull from in the database was an all value query (*). Once I added the individual fields, the error went away.
I've got this error, when I create a user form which has no body section(just header). (Using this method for the messages where I don't expect a user response. Like a progress bar.
Probably, any abnormality(*)or inconsistency with the user form causes this problem.
Solution: Changed the height of the user form just a few pixel.
Just a simple trick worked for me
Go to Excel Options
Manage Excel Add-ins
Uncheck all and click ok

On Click Error: "occurred while Microsoft Access was communicating with the OLE Server or ActiveX Control"

Seems like this is has been asked a few times before.
After working on a form for a few weeks, I suddenly get the error when I click on a button: "The expression On Click you entered as the event property produced the following error: A problem occurred while Microsoft Access was communicating with the OLE Server or Active X Control."
This also happens with any control's event on the form (e.g. After Update on other text fields)
I tried re-installing Access to no avail.
Not sure if this is relevant, but I have a subform on the form as well. I have an "on-click" event that works on the subform, but when the code breaks at the following line (which worked before):
Me.Parent.orderID = Null
The error I get is: "Method 'Parent' of object '_Form_frmOrderQuery' failed
(frmOrderQuery is the name of the subform)
Anyway, this all worked before until I changed the query for the subform by adding a few more fields.
Finally: All of the event handlers (button click, after-update, etc) work on my other forms in the database.
Any help/suggestions would be greatly appreciated.
Thanks,
jeff
Figured it out, this was stupid easy. Whatever Form is having issues, just copy it and delete the old form. Rename the new form to the same as the last (so all your vba and stuff works). Done!
I've just run into a similar problem using the Access runtime environment. It seems that the problem might be with... non-Unicode lanuage settings.
Maybe the names of the columns you added to the query contain some problematic characters?
See this article for reference: https://support.microsoft.com/en-us/kb/907337. It contains a resolution, which helped me.
All the best!
As other users mentioned the problem is in use of non-English symbols in element (form control, etc.) names.
My way to solve it:
(may be unnecessary) Create an event procedure for any element on a form.
Switch to Code Editor.
Place cursor inside any procedure.
Open drop-down list with element names (the left one above the code window).
Check if you see some names with "?????" in them.
If 5 is true, then figure out what the elements are, find them on the form and rename using only basic latin alphabet.
In my case this issue occured because of accented characters.
I was running the VBA code on a computer that uses different non-Unicode language settings than the computer on which i created the event handler, the function, or the subroutine. Note This issue may also occur if the VBA code contains accented characters or special characters. Additionally, this issue may occur if an object name in the Access database contains accented characters or special characters.
The Solution that worked for me:
"If you are running the VBA code on a Microsoft Windows XP-based computer or on a Windows 2000-based computer, you may be able to resolve this issue by changing the non-Unicode language setting on the computer where you are running the VBA code. To verify and to change the non-Unicode language setting, follow these steps.
Note Because there are several versions of Microsoft Windows, the following steps may be different on your computer. If they are, see your product documentation to complete these steps.
Click Start,
click Run,
type Intl.cpl, and then click OK.
Under Language for non-Unicode programs on the Advanced tab, verify that the language matches the language on the computer on which you created the event handler, the function, or the subroutine. If the language differs, click the language that you want, and then click OK.
Restart the computer.
More here https://support.microsoft.com/en-us/help/907337/you-receive-an-error-message-when-you-start-visual-basic-for-applicati

Using querySaveDocument to additional information

We are trying to save some additional information with a document using the QuerySaveDocument event. However it seems that it is not being triggered at all.
<xp:executeScript script="#{javascript:setField(document1, 'cCustAddr1_fi', 'test');}">
</xp:executeScript>
This is our basic script. All the setField() method does is use replaceItemValue to try and set the field. However it seems that QuerySaveDocument is not even being triggered since we can write pretty much anything and the document will still save without problem, even if it would be impossible to execute.
We have also tried using a simple document1.getDocument().replaceItemValue() script, but again I dont think it even attempts to execute. Our documents save perfectly fine too,
Do you see any reason for this, are we doing our saving wrong, or should we be attaching data onto the document in another way?
Thanks.
Your other question on Unplugged (Using other dialog controls in iOS) suggests that you are using the Unplugged Mobile Controls project.
If that is correct then my comment above applies - the querySaveDocument event won't get fired . You can look at the code in UnpSaveDocument.xsp and possibly add your own SSJS code to that.
Alternatively, if you want an additional item created on your back-end Notes document then you should just be able to add a hidden field to the UnpFormEditor that is bound to the document1 data source and using the relevant item name you want.