One approach would be to set the value of the textbox to Null, something
like (untested):
Me!txtBox1 = Null
Good luck!
Regards
Jeff Boyce
Microsoft Access MVP
--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.
Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.
You can thank the FTC of the USA for making this disclaimer
possible/necessary.
"Bellyjeans" <(E-Mail Removed)> wrote in message
news:7e13913f-0434-4066-97f3-(E-Mail Removed)...
> Hi all,
>
> I have a situation that I'm sure is easy to fix, but I'm having a
> moment and my brain won't work. I have a combo box. I have the
> following code on the after update event of the combo box:
>
> If Forms!frmStatus.cboStatusName = "Selection 1" Then
> Me.txtBox1.Visible = True
> Me.txtBox 2.Visible = False
> Else
> Me.txtBox1.Visible = False
> Me.txtBox2.Visible = True
> End If
>
> If Forms!frmStatus.cboStatusName = "Selection 2" Then
> Me.txtBox3.Visible = True
> Me.txtBox4.Visible = True
> Me.txtBox2.Visible = False
> Else
> Me.txtBox3.Visible = False
> Me.txtBox4.Visible = False
> Me.txtBox2.Visible = True
> End If
>
> If Forms!frmStatus.cboStatusName = "Selection 3" Then
> Me.txtBox5.Visible = True
> ElseIf Forms!frmStatus.StatusName = "Selection 4" Then
> Me.txtBox5.Visible = True
> Else
> Me.txtBox5.Visible = False
> End If
>
> If Forms!frmStatus.cboStatusName = "Selection5" Then
> Me.cboBox6.Visible = True
> Else
> Me.cboBox6.Visible = False
> End If
>
> Basically, in a nutshell, the coding makes a number of fields visible
> or invisible, based on what is selected in the combo box
> "cboStatusName". My problem is that if somebody changes the selection
> in cboStatusName, the value in certain combo boxes remains there, even
> if that field is made invisible. How do I make it so that if the
> value in cboStatusName is changed, the fields that become invisible
> also clear their values?
>
> Thanks!
|