G
Gary
I have a strange problem.
I have an option group which consists of two radio buttons.
the option group is tied into a field in my table. and depending on
which button has been pressed the value of the field is either '1' or
'2'.
I want to hide a subform on this form if the value of the field that
the buttons are linked to is '2'. However if the value of the field is
'1' i want to show the subform. I have some code set to run when either
button gets focus. This code checks the value of the field and hides /
unhides the subform accordingly (the code is just below a bit in this
message.)
I have a snag....
It's doing something strange however. the first time either button is
pressed it works fine doing what it should do, however the second and
subsequent times the button is pressed it behaves erraticly and
unreliably. So my solution is to only run the code if it's the first
time the button has been pressed. I thought i'd accomplish this by
putting a bit of code before the code I allready had, as follows.
=================================================================
I put the following code in the 'on open' part of the form.
dim littlefixer as integer
littlefixer = 0
------------------------------------------------------------------
then ... i modified the buttons event code as follows
' added code
littlefixer = littlefixer + 1
If littlefixer <> "1" Then End
Else
'my original code
If Me![User Type].Value = "2" Then Me.[BUSINESS_DETAILS].Visible = True
If Me![User Type].Value = "1" Then Me.[BUSINESS_DETAILS].Visible =
False
End Sub
=============================================
the idea was that when the forms opened 'littlefixer' is set to = 0,
every time a button is pressed littlefixer grows by '1'. by checking to
see if little fixer was <> 1 i am checking to see if the button has
been pressed (taken the focus) more than once.
i've had to use the focus instead of 'on click' because radio buttons
don't appear to have an 'onclick property'.
i'm getting the following error message though when the got focus code
is exectued.
Compile error: variable not defined.
littlefixer = littlefixer + 1
and it highlights the second 'littlefixer' in the line above.
but i have allready dimm'ed this variable in the onopen of the form so
im stuck.
please help
I have an option group which consists of two radio buttons.
the option group is tied into a field in my table. and depending on
which button has been pressed the value of the field is either '1' or
'2'.
I want to hide a subform on this form if the value of the field that
the buttons are linked to is '2'. However if the value of the field is
'1' i want to show the subform. I have some code set to run when either
button gets focus. This code checks the value of the field and hides /
unhides the subform accordingly (the code is just below a bit in this
message.)
I have a snag....
It's doing something strange however. the first time either button is
pressed it works fine doing what it should do, however the second and
subsequent times the button is pressed it behaves erraticly and
unreliably. So my solution is to only run the code if it's the first
time the button has been pressed. I thought i'd accomplish this by
putting a bit of code before the code I allready had, as follows.
=================================================================
I put the following code in the 'on open' part of the form.
dim littlefixer as integer
littlefixer = 0
------------------------------------------------------------------
then ... i modified the buttons event code as follows
' added code
littlefixer = littlefixer + 1
If littlefixer <> "1" Then End
Else
'my original code
If Me![User Type].Value = "2" Then Me.[BUSINESS_DETAILS].Visible = True
If Me![User Type].Value = "1" Then Me.[BUSINESS_DETAILS].Visible =
False
End Sub
=============================================
the idea was that when the forms opened 'littlefixer' is set to = 0,
every time a button is pressed littlefixer grows by '1'. by checking to
see if little fixer was <> 1 i am checking to see if the button has
been pressed (taken the focus) more than once.
i've had to use the focus instead of 'on click' because radio buttons
don't appear to have an 'onclick property'.
i'm getting the following error message though when the got focus code
is exectued.
Compile error: variable not defined.
littlefixer = littlefixer + 1
and it highlights the second 'littlefixer' in the line above.
but i have allready dimm'ed this variable in the onopen of the form so
im stuck.
please help