K
KateB
Hi,
I have 2 fields, Nature_of_advice1 and Nature_of_advice2. Either of these
fields can select the option "other" which will then show fields Other1 or
Other2 for completion. This part works fine! However, if the user selects
"other infection state" in either of the first 2 fields mentioned then they
need to complete a third field which I would like to be hidden unless needed.
I have an after update event for both fields to show/hide the secondary
fields, and have put the same info into the form's OnCurrent field. It all
seems to work OK unless I select "other infection state" in
Nature_of_advice1. If I leave the form and come back to it, the "other
infection state" field is hidden again.
Can anyone suggest where I might be going wrong? I'm not sure if its in the
form event or field event. I suspect its something to do with order? I've
posted the VBA script below, but I should point out I'm a novice so please be
simple with me!!
Kate
Private Sub Form_Current()
If Me.Nature_of_advice1 = "Other" Then
Me.Other1.Visible = True
Else
Me.Other1.Visible = False
End If
If Me.Nature_of_advice2 = "Other" Then
Me.Other2.Visible = True
Else
Me.Other2.Visible = False
End If
If Me.Nature_of_advice1 = "Other infection state" Then
Me.Other_infec_state.Visible = True
Else
Me.Other_infec_state.Visible = False
End If
If Me.Nature_of_advice2 = "Other infection state" Then
Me.Other_infec_state.Visible = True
Else
Me.Other_infec_state.Visible = False
End If
End Sub
I have 2 fields, Nature_of_advice1 and Nature_of_advice2. Either of these
fields can select the option "other" which will then show fields Other1 or
Other2 for completion. This part works fine! However, if the user selects
"other infection state" in either of the first 2 fields mentioned then they
need to complete a third field which I would like to be hidden unless needed.
I have an after update event for both fields to show/hide the secondary
fields, and have put the same info into the form's OnCurrent field. It all
seems to work OK unless I select "other infection state" in
Nature_of_advice1. If I leave the form and come back to it, the "other
infection state" field is hidden again.
Can anyone suggest where I might be going wrong? I'm not sure if its in the
form event or field event. I suspect its something to do with order? I've
posted the VBA script below, but I should point out I'm a novice so please be
simple with me!!
Kate
Private Sub Form_Current()
If Me.Nature_of_advice1 = "Other" Then
Me.Other1.Visible = True
Else
Me.Other1.Visible = False
End If
If Me.Nature_of_advice2 = "Other" Then
Me.Other2.Visible = True
Else
Me.Other2.Visible = False
End If
If Me.Nature_of_advice1 = "Other infection state" Then
Me.Other_infec_state.Visible = True
Else
Me.Other_infec_state.Visible = False
End If
If Me.Nature_of_advice2 = "Other infection state" Then
Me.Other_infec_state.Visible = True
Else
Me.Other_infec_state.Visible = False
End If
End Sub