No. Further questions will be unlikely as I see it. That's because you've explained it well. A rare occurrence for a first-timer.
One confusion I do have though, is why do you think you need a field/control for
Tagged when you already have one for
Received - since the logic clearly determines one from the other. Unless I'm missing something that would be logical tautology - a failure to follow the guidelines of Normalisation theory (See
Database Normalisation and Table Structures).
First let's just take a minute to clarify some terminology. Reports and Forms have Controls that manage the Fields of the record source. Controls needn't have associated fields, but what we're working with here are controls. FYI. Those without associated Fields are termed Unbound Controls.
Controls have various properties, or attributes, that you can use to help manage the form, as well as the controls - and via them the fields - on it.
One point to consider is that there are two points at which the value of a control can be different from the previous value :
- When the control is changed. EG. When clicked for a CheckBox.
- When a different (or first) record is loaded.
In each situation the
other controls need to be set to match the current value. This can be done in VBA code. I'll show an example of that here in a general procedure then discuss later how and when this procedure may be called. In my example code I will name the controls in a way that's standard for their control types. IE. [chkReceived], [txtSource] & [txtDateReceived] :
- Private Sub ShowControls()
-
With Me
-
.txtSource.Visible = .chkReceived
-
.txtDateReceived.Visible = .chkReceived
-
End With
-
End Sub
Notice that this procedure will both show
and hide the extra controls depending on whether [chkReceived] is set or clear.
Now we know what we need to do, we need to ensure it's done at the appropriate points. We've already seen the .Visible property of two controls being used to show and/or hide the controls themselves. Now we're going to look at two more properties related to the control itself (chkReceived], and to the form.
- .AfterUpdate is a property that sets what happens when the control is updated. Setting this to the string value "[Event Procedure]" in the Properties pane for the control will ensure our VBA procedure is called. Click on the ellipsis (...) button to the right of the value for Access to create the procedure for you automatically.
- .OnCurrent (on the Form) does a similar job for whenever a record is changed. This includes when the first record is loaded.
Below is some example code for these two event procedures.
- Private Sub Form_Current()
-
Call ShowControls
-
End Sub
-
-
Private Sub chkReceived_AfterUpdate()
-
Call ShowControls
-
End Sub
Try this and see how you get on.