Dave,
I probably should have mentioned that i created the entire
database w/o using any code - I just used all the features
of the GUI.
That's fine! However, when you want to move beyond "the basics", using code
is the recommended next step and often is the only way to get what you want.
I'm assuming that the text you sent is visual basic (or
does this code just get entered using the expression
builder?)? What is the best way to start with this? Do I
create a "module" and run it After Entry?
The code is often referred to as "visual basic"; more correctly, it is VBA
or Visual Basic for Applications. For the purpose you describe, you would
use the code module which is already available to you in your Form. Here is
how to insert the code I provided:
Open your form in Design View, then:
1. Right-click on your IceCream checkbox. Select "Properties".
2. In the popup window that opens, you will see a set of Tabs. Click the
one that says "Events".
3. In the grid below, locate the row labeled, After Update. It should be
blank. Click anywhere in the white space to the right of the label and you
will see a downward-pointing arrow appear, indicating that this is also a
ComboBox. Click the arrow and select "Event Procedure".
4. Then, notice that there is an ellipsis or three little dots (...) to the
right of the ComboBox. Click the ellipsis and you will open a code window.
You will see that Access has given you a space for entering some code in
this event - it will look something like the following:
Private Sub chkIceCream_BeforeUpdate(Cancel As Integer)
End Sub
5. After the "Private Sub chkIceCream_BeforeUpdate(Cancel As Integer)"
line, insert the following code:
If Me!chkIceCream = True then
Me!chkSprinkles.Enabled = True
Me!chkWhippedCream.Enabled = True
else
Me!chkSprinkles.Enabled = False
Me!chkWhippedCream.Enabled = False
End If
Save the module. Then, click on the Debug menu item in the code window and
select Debug. If the debug produces no errors, just close the module.
Also, what happens if the checkbox is already checked when
the form opens? Won't the other boxes remain gray until
you uncheck and check it again?
Good point. You would insert the code I gave you into the Form's Current
event.
hth,