Problem making things visible

Problem making things visible

am 01.04.2008 21:16:24 von u39419

Here's my code:
If Me![Gender] = "Male" Then
Me.[B1].Visible = Me.[age] < 13
Me.[B3].Visible = Me.[age] > 12

Else
Me.[B2].Visible = Me.[age] < 13
Me.[B4].Visible = Me.[age] > 12
End If

I'm to get it so that if the person is (1st) male and (2nd) under 13 textbox
B1 is shown, and if the're >12 then B3 is shown. The else part is if the're
female with the same age groups.

The problem is that code works for "male", but when "female" is chosen, the
correct "female" box is shown along with both "male" boxes.
What do I need to change?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-ac cess/200804/1

Re: Problem making things visible

am 01.04.2008 21:35:30 von Larry Linson

You did nothing to set the "other sex" Controls to not visible, nor the
inapplicable Control for the "selected sex"... you will need to set all the
Controls for each Record (and in the After Update event for the Gender
Control, if you allow that to be updated). Otherwise, the Visible property
will not be reset to it's designed value until the Form is closed.

Larry Linson
Microsoft Office Access MVP


"noe1818 via AccessMonster.com" wrote in message
news:820a7134e5cd9@uwe...
> Here's my code:
> If Me![Gender] = "Male" Then
> Me.[B1].Visible = Me.[age] < 13
> Me.[B3].Visible = Me.[age] > 12
>
> Else
> Me.[B2].Visible = Me.[age] < 13
> Me.[B4].Visible = Me.[age] > 12
> End If
>
> I'm to get it so that if the person is (1st) male and (2nd) under 13
> textbox
> B1 is shown, and if the're >12 then B3 is shown. The else part is if
> the're
> female with the same age groups.
>
> The problem is that code works for "male", but when "female" is chosen,
> the
> correct "female" box is shown along with both "male" boxes.
> What do I need to change?
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-ac cess/200804/1
>

Re: Problem making things visible

am 02.04.2008 00:04:47 von Wayne Gillespie

On Tue, 01 Apr 2008 19:16:24 GMT, "noe1818 via AccessMonster.com"
wrote:

>Here's my code:
>If Me![Gender] = "Male" Then
> Me.[B1].Visible = Me.[age] < 13
> Me.[B3].Visible = Me.[age] > 12
>
>Else
> Me.[B2].Visible = Me.[age] < 13
> Me.[B4].Visible = Me.[age] > 12
>End If
>
>I'm to get it so that if the person is (1st) male and (2nd) under 13 textbox
>B1 is shown, and if the're >12 then B3 is shown. The else part is if the're
>female with the same age groups.
>
>The problem is that code works for "male", but when "female" is chosen, the
>correct "female" box is shown along with both "male" boxes.
>What do I need to change?

You need to handle all 4 textboxes in both arguments -

If Me![Gender] = "Male" Then
Me.[B1].Visible = Me.[age] < 13
Me.[B3].Visible = Me.[age] > 12
Me.[B2].Visible = False
Me.[B4].Visible = False
Else
Me.[B2].Visible = Me.[age] < 13
Me.[B4].Visible = Me.[age] > 12
Me.[B1].Visible = False
Me.[B3].Visible = False
End If


Wayne Gillespie
Gosford NSW Australia

Re: Problem making things visible

am 02.04.2008 15:03:13 von Patrick A

I've also noticed that you may want to set each control's property to
Visible=n in the property sheet to make things appear (or not appear)
consistently.