Access Form Control Question

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!
 
K

Kipp Woodard

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
 
R

RWright

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!
 
K

Kipp Woodard

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top