Help - VBA Code Will Not Trigger

RSS705

Registered User.
Local time
Today, 11:12
Joined
Jul 11, 2013
Messages
29
Hello there, I'm pretty much brand new to VBA so please bear with me.

My code appears relatively simple, but it refuses to execute. Code is below. If someone could help me out, I'd be extremely grateful as I've been embarassingly stuck on this for several hours now.

As you can probably tell from the below, the code simply is to execute when a lookup field selects "Physician" or "Teaching Hospital" and then is to either enable or disable a field called "Teaching Hospital Name". The final Else statement is just to ensure that if neither option is selected, the field is disabled by default.

Huge thanks in advance to anyone who reads this. Appreciate your time.
Rob

Option Compare Database


Private Sub Form_Current()


Call RecipientType


End Sub


Private Sub Covered_Recipient_Type_AfterUpdate()


Call RecipientType


End Sub


Private Sub RecipientType()


If Me.Covered_Recipient_Type = "Physician" Then


Me.Teaching_Hospital_Name = Null
Me.Teaching_Hospital_Name.Enabled = False


ElseIf Me.Covered_Recipient_Type = "Teaching Hospital" Then


Me.Teaching_Hospital_Name.Enabled = True


Else


Me.Teaching_Hospital_Name.Enabled = False


End If


End Sub
 
What version of Access? Presuming 2007 or later, the db must be in a trusted location or you need to have explicitly enabled code with the option just under the ribbon.
 
Access 2010, could you provide a little more detail as to where this option is? I apologize, normally okay with finding these setings but am not seeing it.

This would explain so much!!

Thanks again,
Rob
 
Attached, or File/Options/Trust Center.
 

Attachments

  • Enable.jpg
    Enable.jpg
    51.7 KB · Views: 75
As a quick follow up it appears as if my IT department (on a work laptop) has disabled macros for security purposes, and as is I am unable to enable this feature.

Thank you for help! Wouldn't have figured this out otherwise.
 

Users who are viewing this thread

Back
Top Bottom