Access Form Control Question

  • Thread starter Thread starter RWright
  • Start date Start date
R

RWright

I am designing a form in access and have the following 2 fields:

1. Source (which is a drop down box containing the options "Referral",
"Submission," and "Prior Experience.")

2. Referral Source (this a drop down box containing a list of names)

I want the referral source field to be "grey out" (sorry- not sure if this
is the technical term for it!) if the form user selects "Referral" in the
source field.

Can anyone tell me how to accomplish this? I am in Access 2007. Much of what
I am doing is by trial and error but I havent the slightest idea how to
accomplish this.

Thank you in advance!
 
In the AfterUpdate event of the first drop-down, set the Locked property of
the second control.

Something like this:

Private Sub cboSource_AfterUpdate()

If Me.cboSource = "Referral" Then
If Me.ActiveControl.Name = "cboReferralSource" Then
Me.cboSource.SetFocus
End If

Me.cboReferralSource = "n/a"
Me.cboReferralSource.Locked = True
Else
Me.cboReferralSource.Locked = False
End If

End Sub
 
Oh Dear. Thanks, Kipp but this might be a little advanced for me. I can
locate the AfterUpdate event in the properties, but after that, I am lost.

Also, in my original post, I meant to say that I would like the Referral
Source to be greyed out if the answer if the user does NOT pick "Referral"
under Source.

Thanks!
 
Here's and opportunity to get your feet wet with VBA!

Click the builder button to the right of the AfterUpdate property. Select
Code. Paste in this code:

If Nz(Me.cboSource) <> "Referral" Then
If Me.ActiveControl.Name = "cboReferralSource" Then
Me.cboSource.SetFocus
End If

Me.cboReferralSource = "n/a"
Me.cboReferralSource.Locked = True
Else
Me.cboReferralSource.Locked = False
End If
 
Back
Top