Log in

View Full Version : Solved: Show/Hide Label depending on Radio Button



OhGorgeous1
08-10-2009, 02:53 AM
Can anyone please help me with the following...

I have a form in Access 2003 and have two radio buttons (Yes/No) siting in a frame (Response) and what I want is if the user clicks on Yes (rdYes) then the label containing the word A0A is displayed if the user clicks on No (rdNo) then the label containing the word G1A is displayed

I have the following code but can't get it to work (obviousely it's wrong)


Private Sub Response_GotFocus()
If Me.Response = 1 Then
Me.A0A.Visible = True
Else
If Me.Response = 2 Then
Me.G1A.Visable = True
End If
End Sub


I would be most grateful for any help/guidance on this

CreganTur
08-10-2009, 05:09 AM
Private Sub Response_GotFocus()
If Me.Response = 1 Then
Me.A0A.Visible = True
ElseIf Me.Response = 0 Then
Me.G1A.Visable = True
End If
End Sub


Does the above code fix the problem? Your ElseIf had incorrect syntax. Also, with a radio button you're looking for 0 - False, or 1 - True. This is standard boolean syntax for determining true or false.

HTH:thumb

OhGorgeous1
08-12-2009, 06:02 AM
Perfect, many thanks