a subform with a strange behavior

odrap

Registered User.
Local time
Today, 14:48
Joined
Dec 16, 2008
Messages
156
On a form i have a subform "SfrmOrders". The visiblity of this subform is set to false in the properties window.
I have on my form a button "CmdSfrmOrders" with the following Click event

If CmdSfrmOrders.Caption = "Show saved orders" Then
Me!SfrmOrders.Visible = True
CmdSfrmOrders.Caption = "Hide saved orders"
CmdSfrmOrders.ForeColor = RGB(255, 0, 0)
Else
Me!SfrmOrders.Visible = False
CmdSfrmOrders.Caption = "Show saved orders"
CmdSfrmOrders.ForeColor = RGB(0, 0, 0)
End If

This works fine but with a strange behavior when the subform is made visibile for the first time. In this case i have to cick twice on the button to get the subform visibile. After that only one click suffice.
What's the reason for the need to click twice the first time ?
 
Some backgroud info please. What is the value of CmdSfrmOrders.Caption when you make the subform visible the first time? If it isn't "Show saved orders" then you would get the behaviour you describe.

I would set a breakpoint at the start of your OnClick code so you an see exacty what is happening
 

Users who are viewing this thread

Back
Top Bottom