Sticky Toggle Button doesnt stay pressed down

G

Guest

Good evening,

I have a continous form with a row of toggle buttons on the header section.
Each toggle button, works independantly of the other toggle buttons (they are
not part of an option group)... When any toggle button is pressed down, it
executes a procedure that 1) checks to see which other toggle buttons are
clicked and then 2) filters the records according to which toggle buttons are
pressed.

The problem arises when, having pressed down all the other toggle buttons
save one, the user goes to click on the very last toggle button. The last
toggle button, which can be any of the toggle buttons since there is no
order, does execute its code perfectly and filter the records perfectly
however the button does not stay pressed down -- It remains in the unpressed
popped-up state. SO the user assumes it was not pressed at all.

and This can happen to any of the toggle buttons if they are the last toggle
button to be pressed.


Any ideas?
Cheers,
WebDude Confused.
 
W

Wayne Morgan

What is the code behind the button(s)? Is the button bound to a field? You
mention these are on a continuous form, are you referring to pressing
multiple buttons in a single record or buttons on multiple records?
 
G

Guest

Does all the buttons are connected to the same function/sub, if so, can you
post the code of this function/sub
 
G

Guest

Ofer said:
Does all the buttons are connected to the same function/sub, if so, can you
post the code of this function/sub

Hi Ofer,

Im not sure there is anything in the code to cause
the visual problems with the toggle button but
since you asked for the code..



[introduction]

When the form is first loaded,
ALL the records are displayed
and all the toggle buttons are set to
FALSE (they are in the
untouched popped up state).

If the user decides to filter out (remove)
certain records, say records whose
[VolunteeringRole] field = "clerical"
all they have to do is press the
toggle button named "clerical".

Every toggle buttons on_click event
calls the following procedure;


((fyi: the code works for every
toggle button.. the only thing that
doesnt work is the visual look
of the toggle button to be pressed last,
which ever button that is, does not remain down
even though its code executes))





Private Sub EvaluateRoleButtons()

Dim FilterString As String


If Me.ClericalButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Clerical'"
End If

If Me.ClothingRoomButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Clothing Room'"
End If

If Me.CreativePlayButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Creative Play'"
End If

If Me.DriverButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Driver'"
End If

If Me.FamilySupportButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Family
Support'"
End If

If Me.GraphicDesignButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Graphic
Design'"
End If

If Me.OlderBrotherButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Older
Brother'"
End If

If Me.OlderSisterButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Older
Sister'"
End If

If Me.ProgramAnimationButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Program
Animation'"
End If

If Me.TutorButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Tutor'"
End If

If Me.OtherButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Other'"
End If

If Me.NoneButton = False Then
FilterString = FilterString & " Or IsNull([VolunteeringRole])"
End If







If FilterString = "" Then

'return no records
Me.Filter = "[VolunteeringRole] = 'Abracadabra'" ' to make sure
' there are no
' records returned.

Else

Me.Filter = Mid(FilterString, 5) 'returns everything
'from the 5th character
'onwards

End If




Me.FilterOn = True


End Sub






At your service,
WebDude.
 
G

Guest

Hi Wayne!

Thanks for taking the time
out of your day
to reply to my post :)


You mention these are on a continuous form, are you referring to pressing
multiple buttons in a single record or buttons on multiple records?

I placed several toggle buttons on the FORM HEADER section of a continous
form. There are no buttons on the individual records themselves. I made the
detail section of the same continous form very small (and with just a few
record fields) so i that the continous form can display several records at a
time. The toggle buttons filter the forms record source which in turn effect
the number of records displayed in the continous forms detail section.
Is the button bound to a field?

no...before you had mentioned it, i had no idea i could actually bind a
toggle button
to a field.


What is the code behind the button(s)?




[brief intro]

When the form is first loaded,
ALL the records are displayed
and all the toggle buttons are set to
FALSE (they are in the
untouched popped up state).

If the user decides to filter out (remove)
certain records, say records whose
[VolunteeringRole] field = "clerical"
all they have to do is press the
toggle button named "clerical".

Every toggle buttons on_click event
calls the following procedure;


((fyi: the code works for every
toggle button.. the only thing that
doesnt work is the visual look
of the toggle button to be pressed last,
which ever button that is, does not remain down
even though its code executes))





Private Sub EvaluateRoleButtons()

Dim FilterString As String


If Me.ClericalButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Clerical'"
End If

If Me.ClothingRoomButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Clothing Room'"
End If

If Me.CreativePlayButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Creative Play'"
End If

If Me.DriverButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Driver'"
End If

If Me.FamilySupportButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Family
Support'"
End If

If Me.GraphicDesignButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Graphic
Design'"
End If

If Me.OlderBrotherButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Older
Brother'"
End If

If Me.OlderSisterButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Older
Sister'"
End If

If Me.ProgramAnimationButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Program
Animation'"
End If

If Me.TutorButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Tutor'"
End If

If Me.OtherButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Other'"
End If

If Me.NoneButton = False Then
FilterString = FilterString & " Or IsNull([VolunteeringRole])"
End If







If FilterString = "" Then

'return no records
Me.Filter = "[VolunteeringRole] = 'Abracadabra'" ' to make sure
' there are no
' records returned.

Else

Me.Filter = Mid(FilterString, 5) 'returns everything
'from the 5th character
'onwards

End If




Me.FilterOn = True


End Sub




My home is your home,
WebDude :)
 
G

Guest

I just noticed,
Why did i post this in the queries discussion group?

its a forms control question.. about toggle buttons!

I think its cause it was late,
and webdude can get very sleepy
staying up all night.

wb
 
G

Guest

Sorry, but I can't see any thing in the code that can cause that, it might be
somewhere else and not in this sub.
In my experience when something like that happen, I build the form again,
and add each piece of the code and items one by one and then run it to see
what can cause the problem.
Again sorry.
--
I hope that helped
Good luck


WebDude said:
Ofer said:
Does all the buttons are connected to the same function/sub, if so, can you
post the code of this function/sub

Hi Ofer,

Im not sure there is anything in the code to cause
the visual problems with the toggle button but
since you asked for the code..



[introduction]

When the form is first loaded,
ALL the records are displayed
and all the toggle buttons are set to
FALSE (they are in the
untouched popped up state).

If the user decides to filter out (remove)
certain records, say records whose
[VolunteeringRole] field = "clerical"
all they have to do is press the
toggle button named "clerical".

Every toggle buttons on_click event
calls the following procedure;


((fyi: the code works for every
toggle button.. the only thing that
doesnt work is the visual look
of the toggle button to be pressed last,
which ever button that is, does not remain down
even though its code executes))





Private Sub EvaluateRoleButtons()

Dim FilterString As String


If Me.ClericalButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Clerical'"
End If

If Me.ClothingRoomButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Clothing Room'"
End If

If Me.CreativePlayButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Creative Play'"
End If

If Me.DriverButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Driver'"
End If

If Me.FamilySupportButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Family
Support'"
End If

If Me.GraphicDesignButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Graphic
Design'"
End If

If Me.OlderBrotherButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Older
Brother'"
End If

If Me.OlderSisterButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Older
Sister'"
End If

If Me.ProgramAnimationButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Program
Animation'"
End If

If Me.TutorButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Tutor'"
End If

If Me.OtherButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Other'"
End If

If Me.NoneButton = False Then
FilterString = FilterString & " Or IsNull([VolunteeringRole])"
End If







If FilterString = "" Then

'return no records
Me.Filter = "[VolunteeringRole] = 'Abracadabra'" ' to make sure
' there are no
' records returned.

Else

Me.Filter = Mid(FilterString, 5) 'returns everything
'from the 5th character
'onwards

End If




Me.FilterOn = True


End Sub






At your service,
WebDude.
 
G

Guest

Ofer said:
Sorry, but I can't see any thing in the code that can cause that, it might be
somewhere else and not in this sub.
In my experience when something like that happen, I build the form again,
and add each piece of the code and items one by one and then run it to see
what can cause the problem.

Yeah, thats what ive been thinking, that the form is corrupt.

It happaned to me before and to solve that problem i

1) created a new databsae
then
2) imported all the forms, queries, tables..etc from the old database to the
new databse.

...ill try it with this databse again to see what happens.

thanks for taking the time to
look over my code though :)

Cheers,
WebDude
 
G

Guest

Good luck.
--
I hope that helped
Good luck


WebDude said:
Yeah, thats what ive been thinking, that the form is corrupt.

It happaned to me before and to solve that problem i

1) created a new databsae
then
2) imported all the forms, queries, tables..etc from the old database to the
new databse.

..ill try it with this databse again to see what happens.

thanks for taking the time to
look over my code though :)

Cheers,
WebDude
 
W

Wayne Morgan

The code looks good and the buttons in the form's header should work fine.
Since this is now something that makes no sense at all (unless you have some
other code causing the problem) I would suspect a corrupted form, as you had
mentioned.

--
Wayne Morgan
MS Access MVP


WebDude said:
Hi Wayne!

Thanks for taking the time
out of your day
to reply to my post :)


You mention these are on a continuous form, are you referring to pressing
multiple buttons in a single record or buttons on multiple records?

I placed several toggle buttons on the FORM HEADER section of a continous
form. There are no buttons on the individual records themselves. I made
the
detail section of the same continous form very small (and with just a few
record fields) so i that the continous form can display several records at
a
time. The toggle buttons filter the forms record source which in turn
effect
the number of records displayed in the continous forms detail section.
Is the button bound to a field?

no...before you had mentioned it, i had no idea i could actually bind a
toggle button
to a field.


What is the code behind the button(s)?




[brief intro]

When the form is first loaded,
ALL the records are displayed
and all the toggle buttons are set to
FALSE (they are in the
untouched popped up state).

If the user decides to filter out (remove)
certain records, say records whose
[VolunteeringRole] field = "clerical"
all they have to do is press the
toggle button named "clerical".

Every toggle buttons on_click event
calls the following procedure;


((fyi: the code works for every
toggle button.. the only thing that
doesnt work is the visual look
of the toggle button to be pressed last,
which ever button that is, does not remain down
even though its code executes))





Private Sub EvaluateRoleButtons()

Dim FilterString As String


If Me.ClericalButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Clerical'"
End If

If Me.ClothingRoomButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Clothing Room'"
End If

If Me.CreativePlayButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Creative Play'"
End If

If Me.DriverButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Driver'"
End If

If Me.FamilySupportButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Family
Support'"
End If

If Me.GraphicDesignButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Graphic
Design'"
End If

If Me.OlderBrotherButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Older
Brother'"
End If

If Me.OlderSisterButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] = 'Older
Sister'"
End If

If Me.ProgramAnimationButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Program
Animation'"
End If

If Me.TutorButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Tutor'"
End If

If Me.OtherButton = False Then
FilterString = FilterString & " Or [VolunteeringRole] =
'Other'"
End If

If Me.NoneButton = False Then
FilterString = FilterString & " Or IsNull([VolunteeringRole])"
End If







If FilterString = "" Then

'return no records
Me.Filter = "[VolunteeringRole] = 'Abracadabra'" ' to make sure
' there are no
' records returned.

Else

Me.Filter = Mid(FilterString, 5) 'returns everything
'from the 5th character
'onwards

End If




Me.FilterOn = True


End Sub




My home is your home,
WebDude :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top