My problem is that the question I need to ask has been answered quite well in "Turn Off fields in a form based on selection made from combo box." But I can't make it work in my case...
So...here goes. I have a main form and a subform. The main form simply lets the user know they have selected their "Pin Number correct." There are no active controls on the main form. The subform (sfrmSignOut) has four active controls.
It's the subform that is causing me grief. On the subform is a combobox (cboDestination). The form/subform opens with control on this combobox. The user either enters or selects from a list of destinations. When a destination is selected, a text field on the subform (txtTime) automatically enters the time and the record saved.
The relationship between cboDestination and txtTime is controlled by an update event on the cbobox (DoCmd.RunCommand acSaveRecord). This seems to works fine.
Now what I would like to do is "turn off" the remaining two txtboxes depending upon the selection made in cboDestination. If the user signs out for the day, I want the purpose and return time to disappear.
I've written more code in the update event of cboDestination using a select case. But it isn't working. Here is my code -- where did I goof?
Private Sub cboDestination_Update()
Dim strValue as String
strValue=Me!cboDestination
Me.txtTime=Now()
DoCmd.RunCommand acCmdSaveRecord
Select Case strValue
Case "Central Office"
Me!cboPurpose.Visible=False
Me!txtEstRetTime.Visible=False
Case "Signing Out for Remainder of Day"
Me! cboPurpose.Visible=False
Me! txtEstRetTime.Visible=False
Case Else
Me! cboPurpose.Visible=True
Me! txtEstRetTime.Visible=True
End Select
I then use an event procedure on the subform, when it's opened again for another user, to make both these boxes visible again if they've been turned off by the previous user...
So...here goes. I have a main form and a subform. The main form simply lets the user know they have selected their "Pin Number correct." There are no active controls on the main form. The subform (sfrmSignOut) has four active controls.
It's the subform that is causing me grief. On the subform is a combobox (cboDestination). The form/subform opens with control on this combobox. The user either enters or selects from a list of destinations. When a destination is selected, a text field on the subform (txtTime) automatically enters the time and the record saved.
The relationship between cboDestination and txtTime is controlled by an update event on the cbobox (DoCmd.RunCommand acSaveRecord). This seems to works fine.
Now what I would like to do is "turn off" the remaining two txtboxes depending upon the selection made in cboDestination. If the user signs out for the day, I want the purpose and return time to disappear.
I've written more code in the update event of cboDestination using a select case. But it isn't working. Here is my code -- where did I goof?
Private Sub cboDestination_Update()
Dim strValue as String
strValue=Me!cboDestination
Me.txtTime=Now()
DoCmd.RunCommand acCmdSaveRecord
Select Case strValue
Case "Central Office"
Me!cboPurpose.Visible=False
Me!txtEstRetTime.Visible=False
Case "Signing Out for Remainder of Day"
Me! cboPurpose.Visible=False
Me! txtEstRetTime.Visible=False
Case Else
Me! cboPurpose.Visible=True
Me! txtEstRetTime.Visible=True
End Select
I then use an event procedure on the subform, when it's opened again for another user, to make both these boxes visible again if they've been turned off by the previous user...