Disable/Enable Fields Based on Form Choices (Access 2003)

C

chibicheebs

Good Afternoon.

I have a very basic Form in Access which helps me keep track of Applicants
and their Status.

I have an Option Group called Frame95 with 4 Options in it: Active, Hired,
Not Hired, and On File.

I then have 2 Combo Boxes: Active Status and Not Hired Reasons.

--When Active is clicked, I want Active Status to be Enabled and Not Hired
Reasons to be Disabled.

--When Not Hired is clicked, I want Not Hired Reasons to be Enabled and
Active Status to be Disabled.

--When Hired is clicked, I want BOTH Combo boxes to be Disabled.

--When On File is clicked, I want BOTH Combo Boxes to be Disabled.


I am very new to Access. So if you are putting X-Factors into the Formula,
please let me know by coloring them or something of the sort so I know I
should change them to something different--such as the name of my particular
field. And make a note of it.

I am very new to Visual Basic as well. So please try to explain as best you
can.

I will be on all day today so I can answer any inquiries that may be brought
up.

Thank you so much everyone.

-Steffane
 
P

PJFry

If you look at the properities for each of the four options in the option
group, you will see that they have a name. It will be something like
'Toggle1'.

Post the names of the toggle buttons in Frame95 as well as the names of the
combo boxes that you are enabling.
 
S

Steve Sanford

You didn't state the names of the combo boxes so I'll use these names:

Option Group name = Frame95
Active Status combo name = cboActiveStatus
Not Hired Reasons combo name = cboNotHiredReasons

The option group values I used are:

Active = 1
Not Hired = 2
Hired = 3
On File = 4


Open the form in design view and set the Enabled property for the two combo
boxes to FALSE

Open the properties dialog for the frame control. Click on the "On Click"
property line . Ensure that "[Event Procedure]" displays, then click on the
elipis (...) on the right.

Paste in the following sub:

'---------------------------------------------
Public Sub cbo_EnableDisable()
' Enables, Disables combo boxes on the form

Select Case Me.Frame95 ' option group
Case 1 ' Active
Me.cboActiveStatus.Enabled = True
Me.cboNotHiredReasons.Enabled = False

Case 2 'Not Hired
Me.cboActiveStatus.Enabled = False
Me.cboNotHiredReasons.Enabled = True

Case 3, 4 ' 3=Hired 4 = On File
Me.cboActiveStatus.Enabled = False
Me.cboNotHiredReasons.Enabled = False

Case Else
MsgBox "Error... Help ME!!"
End Select

End Sub
'---------------------------------------------

The Frame95 click event cdoe should look like this:

Private Sub Frame95_Click()

Call cbo_EnableDisable

End Sub


Go back to the form (still in design view) and click in the "On Current"
line in the form properites dialog. Ensure that "[Event Procedure]" displays,
then click on the elipis (...) on the right.

Make the sub look like this:

Private Sub Form_Current()

Call cbo_EnableDisable

End Sub


Save the form, then test it.

HTH
 

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