0

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?

braX
  • 11,506
  • 5
  • 20
  • 33
CodeMed
  • 9,527
  • 70
  • 212
  • 364

2 Answers2

2

my advices?

  1. You could rename your Forms!....SourceObject to "Address" instead of "Addresses"
  2. You could copy/paste the form, delete the original, and retry
  3. 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 ...
Community
  • 1
  • 1
Philippe Grondier
  • 10,900
  • 3
  • 33
  • 72
  • Thank you. +1 for trying to help. I already tried your #1 and #2 before the posting. I may try your #3 when I sit down with this again tomorrow. I just spent the past hour deleting every object related to addresses in the database and building that module back up from scratch. Everything worked again until I added the View button again, at which point the same error message came up again for both buttons on the form that lists addresses. Even though the similar buttons in the forms module work fine. Any other ideas? – CodeMed Sep 26 '13 at 00:02
  • Thank you again. MZ Tools for the VBA editor only supports version 6.0 of Visual Basic, but Access 2010 uses version 7.0. Do you have another freeware solution? Also, the links you sent include comments by others asking for a worked out sample blog post with code and a downloadable database. Do you know of such an example? I am very new to VBA and am only doing this as a volunteer project for charity. For your code-behind suggestion, can I simply take my event methods and put them into back-end methods which are called by the event methods? Would that improve debugging? – CodeMed Sep 26 '13 at 17:14
  • I created a new database and imported everything but the ListClientAddresses table and qryListClientAddresses. Then I built a new qryListClientAddresses. I created a continuous form ListClientAddresses and it worked before I added any buttons. I then added an AddNewClient button with the same code as in the database uploaded above. It added a record to tblClientAddress, but the new record was not visible in the search results in the ListClientAddresses form. Then I started getting the same error message as in my posting above. All before even creating the View button. – CodeMed Sep 26 '13 at 17:23
0

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.

CodeMed
  • 9,527
  • 70
  • 212
  • 364