Visible property not working

wallymeister

Registered User.
Local time
Today, 06:58
Joined
May 10, 2011
Messages
30
I have a form. It is Switchboard form. Throughout my application I am hiding and unhiding it as needed. However, in the last operation I added to the menu, I am printing a report and On_Close event of report I set the visible property of the form to TRUE but it's not appearing as in all the other operations I have done. I step through the code and the visible property is FALSE before and after the code that resets it. Is there any reason anyone knows of that can cause this to not change. I am using IsLoaded function to determine if it is open but not visible, so it is open, just not working for this part of my program which is the same as other parts. The part that is confusing me is that it's not visible because the execution of the code is not changing it's value. It's just weird.

Any help or suggestions are appreciated.
Wally
 
I would assume that you are not addressing the Form correctly. But I can't be sure looking at your code which come is two parts. One to open the Report and the other to close it.

What happens if you do not use any code to set the Visible Property to False.

Just open and close the Report. That is what I always do.
 
Hi RainLover
I am addressing the form correctly. Many times throughout my code.
In the Property Sheet for the Form in Desing view the Visible property is not there. So what do you mean set it without using code? I have never set a form to be hidden in property sheet, only via code.

There's no problem with closing the report, only that the Switchboard form is not visible after closing. Code in the On_Close of the report resets visible property to TRUE but it doesn't reset. As I said, I step through the code and after the step that resets the visible property to TRUE it is still FALSE in the Add Watch Window. There is no error, just that the visible property is not changing via code. Just in this instance of my program.

This is the code that runs but doesn't change
Forms![Switchboard].Visible = True

Anyway thanks for the reply
Any other ideas are appreciated
Wally
 
OK, after some forum searching I found a post that mentioned setting focus to form after setting visible property. I added... Forms![Switchboard].SetFocus = True and now it works. Why I had to do that makes no sense to me because in all the other instances (2) of printing a report I didn't have to do that. But,.... it works so.

Learned something new I guess!!!

Thanks
Wally
 
Hi RainLover
So what do you mean set it without using code? I have never set a form to be hidden in property sheet, only via code.

Wally

Happy you found your own solution. It is a good way to learn.

I did not explain myself very well. Sorry.

What I am trying to say is that I never set the Visible Property to False.(Talking code here not the Properties box)

I simply open the Report and leave the Switchboard alone. The Report gets the Focus and the Form is no longer visible. When I close the Form (Simply with Do.Cmd or the X in the top right hand corner, then the Form becomes visible. All without using Code to set the Property.

When the Report is open I can use F6 to go back to the Form and then do something else, like opening a different Report or Form.

Hope I explained myself better this time.

Cheers. :)
 

Users who are viewing this thread

Back
Top Bottom