Cmd button text colour and caption not changing

M

Michael

I have the following code in the on click event of a SimpleFilter cmd button
in the footer of a form.

I had a lot of problems until I discovered that acCmdFilterByForm disabled
command buttons and that only the toolbar buttons worked but
I came to terms with that!

The idea is for a cmd button click to bring up the filter by form (it does);
then I use the Apply Filter button on the toolbar to apply
the filter (it does); then re-click the cmd button and the filter is
cancelled (it is).

Since it works as intended the changes to ForeColor and Caption must be
working in the background but they do not change the colour and
caption on the screen.

I have tried re-paint for the screen in various places but still cannot get
the screen to reflect the background values of the ForeColor and Caption.

Please can someone help?

Thank you, Michael.

If Me.cmdSimpleFilter.ForeColor = 255 Then ' If the button colour is red and
filter has been selected
' Reset colours and cancel filter
Me.cmdSimpleFilter.ForeColor = 16744448
Me.cmdSimpleFilter.Caption = "Simple filter"
Me.FilterOn = False
Else ' Make button text colour red
Me.cmdSimpleFilter.ForeColor = 255
Me.cmdSimpleFilter.Caption = "Cancel filter"
Forms("frmCollectionView").Filter = "" ' Clear any existing filter on
town
' NB next command disables all cmd buttons etc - only toolbar
' buttons are available and there is no way round this
DoCmd.RunCommand acCmdFilterByForm
End If
 

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

Top