Access Form buttons not working in form view

AShaw

Registered User.
Local time
Tomorrow, 03:18
Joined
Jul 3, 2014
Messages
23
Hello,

A colleague of mine opened up an Access 2010 database that I have been working on, then clicked a bunch of buttons (she can't remember what she pressed) and then closed it. Now when I open it, none of the buttons work on the form.

Prior to my colleague opening it, it used to open and offer a yellow message asking whether I would like to 'enable'. I always click 'yes' and everything works without issues. I don't know what she pressed, but that yellow message no longer appears. I went to Trust Centre, Macro Settings to Enable all macros and ActiveX Settings to Enable all controls, but the issue is not resolved.

I took a backup copy the day before this happened, but I had just finished an hour or two of adding in queries before saving and closing it when she did this so I don't want to lose those. Plus, I really want to know how to fix this as my colleague will probably do this again since she is the end user.

Please help!:eek:
 
When you say none of the buttons work what do you mean?

1. When you click it doesn't depress?
2. It depresses but the code behind it doesn't run?
3. You can't click on the button at all because it looks disabled?

Welcome to the forum! :)
 
Sorry, I will be more informative:
frmMain has five buttons on it and each of these open a separate form. Normally in form view, I click on one of these buttons, say the Victim button, and it opens the Victim form where my colleague will be entering information about the victims. She can't remember what she pressed but now when I click the Victim button the form does not open (none of the forms open after I click their buttons). A faint dotted line appears around the button so I assume it is depressed, but the Victim form is not opening.
 
Ok so frmMain is like your switchboard and you created these buttons using the button wizard? It sounds like the event that's linked to the button has been deleted.

1. In Design View open the Property Sheet of the button. You do that by right-clicking the button and clicking Properties.
2. Click the Events tab and look for the On Click event.
3. Click the elipsis button (...), select Event Procedure and Click ok

It should take you to a different window where there's code.

Go back to your form, run it and test that button.
 
This is the code I see when I click on the Perpetrator form button and follow your instructions:

Option Compare Database
Private Sub cmdOpenPerpetratorForm_Click()
End Sub
Private Sub Form_Load()
End Sub

I clicked 'run' and a pop-up box appears named 'Macros' and asks for the macro name. There are no macros to choose from in that box - it is empty.
 
Alright, it would be a macro it creates.

Go back to the property sheet and this time instead of clicking the ellipsis button, click the arrow to the left of the button and select "Macro Builder" from the list. Re-test the button.
 
I tried that, but clicking the arrow only offers me one selection. [Event Procedure] is my only option there. I opened up the previous version (backup) that I'd saved the day before, and following your prior instructions ("Click the elipsis button (...), select Event Procedure and Click ok") opens up a great deal more code than the currently broken version of the database. I have pasted the properly functioning backup copy's code below (note that several months ago the button was renamed 'offender' instead of 'perpetrator' which is why you'll see both words in the code below). At worst I can just copy all of this code onto the newer version, but surely there is an easier way to fix this?

Option Compare Database
Option Explicit
Private Sub cmdClear_Click()
Me.Main_SubForm.SourceObject = "frmStart"
Me.Refresh
End Sub

Private Sub cmdOpenEventForm_Click()
Me.Main_SubForm.SourceObject = "frmEvent"
Me.Refresh
End Sub
Private Sub cmdOpenPerpetratorForm_Click()
Me.Main_SubForm.SourceObject = "frmOffenderMain"
Me.Refresh
End Sub
Private Sub cmdOpenPerpVictRelationshipForm_Click()
Me.Main_SubForm.SourceObject = "frmOffenderDeceasedRelationshipMain"
Me.Refresh
End Sub
Private Sub cmdOpenSurvivngFamilyMemberForm_Click()
Me.Main_SubForm.SourceObject = "frmSurvivingFamilyMemberMain"
Me.Refresh
End Sub
Private Sub cmdOpenVicitmForm_Click()
Me.Main_SubForm.SourceObject = "frmDeceasedMain"
Me.Refresh
End Sub
Private Sub Form_Load()
Me.Main_SubForm.SourceObject = "frmStart"
Me.Refresh
End Sub
 
I had already tried Trusted Locations. I added in:
C:\Users\ashaw\Desktop\ (my desktop location where I temporarily pasted the database to see if I could get it working there)
E:\ (where I have back up and current copies on a USB)
And of course C: where Access itself is stored along with its MS Office associates.

It didn't help at all.
 
To ensure that the button actually works, go to the code window and between the Private Sub and End Sub lines for the buttons you ran the steps before, enter this:
Code:
Msgbox "I was clicked"
Go back to the form and test that button.
 
Yes, a pop-up box informing "I was clicked" now appears when I click the form button.
 
Now you know what to do. Copy and paste the single lines of code between the Private Sub and End Sub lines and paste it into your new db. Simple enough!
 
Thanks, but while its easy enough for me to copy and paste code, the data entry people can't fix this themselves and I won't be here in a few months so if she does this again she won't have anyone to help her. I have no idea what she pressed to have broken it like this and she can't remember.
Is there a quick way to 'lock' it so she can't accidentally damage things, while at the same time allowing a database/admin/IT user to unlock it and make changes after I leave this job? I'm a SAS user with little knowledge of Access but I was asked to help because no one else can.
 
She obviously had access to the development side of the the application so it seems whoever developed it before you didn't properly 'seal' it up. You'll need to split the db into two parts, Front End and Back End. The Front End will contain the forms/reports and remain locked and the Back End will contain your data.

Here's some more info on this:

http://allenbrowne.com/ser-01.html

Maybe Gina has more links to provide on this topic.
 
They paid an external provider several thousand $ to build it for them but it was full of spelling mistakes and errors. The manager didn't want to look bad in front of her manager so she just asked me to fix it for them. I told them it would have been better to start again from scratch.

Thanks for all the help.
 

Users who are viewing this thread

Back
Top Bottom