.Visible property being ignored

M

Mark A. Sam

Hello,

I placed this code in the OnLoad event of a form:

If OpenArgs = "Products" Then 'Open to Pruducts tab if this is open from
Freight Reconciliation
[Products].SetFocus
ElseIf OpenArgs = "TaskScheduler" Then 'Hide nagivation/find controls since
record is filtered
[FindOrder].Visible = False
[Box17].Visible = False
[Firstrec].Visible = False
[Prevrec].Visible = False
[Nextrec].Visible = False
[Lastrec].Visible = False
End If


The Openargs is set to "TaskScheduler" I want those particular controls
invisible on the form. This happens to all of the controls except
{FindOrder], which is an unbound combobox. When I step through the code,
[FindOrder] maintains its visible = true property. I have seen this happen
before.

This is Access 2002 running on WinXP.

Thanks for any help.

God Bless,

Mark A. Sam
 
K

Ken Snell

Is [FindOrder] the first control in the tab order? If yes, it gets the focus
when the form is being opened/loaded, and you cannot make it invisible while
it has the focus.

If this is the problem, then set the focus to another control before you
make the FindOrder control invisible.
 
A

Allen Browne

Mark, try a SetFocus in the ElseIf also.

If FindOrder is in the Form Header section, Access (2000 especially) does
have some serious challenges in getting the display right. The fact that
it's the first one is possibly the issue, so hopefully that will help.

To help sort this out, add:
Debug.Print Me.FindOrder.Visible
to the verify the fact that the code hid it. You might also try the form's
Open event without the SetFocus bit.
 
M

Mark A. Sam

The procudure was working fine, but I made a modification changing the
Openargs from the word "TaskScheduler" to "LimitView"


If OpenArgs = "Products" Then
pubDaysOE = 1825
[Commercial].SetFocus 'Set focus to Commercial Tab
[FindOrder].Visible = False
[Box17].Visible = False
[Firstrec].Visible = False
[Prevrec].Visible = False
[Nextrec].Visible = False
[Lastrec].Visible = False
[Products].SetFocus 'Open Products Tab
ElseIf OpenArgs = "LimitView"
pubDaysOE = 1825
[Commercial].SetFocus
[FindOrder].Visible = False
[Box17].Visible = False
[Firstrec].Visible = False
[Prevrec].Visible = False
[Nextrec].Visible = False
[Lastrec].Visible = False
End If

Now the FindOrder control becomes invisible, but the other controls to not,
even though the Visible Property reports as being False when I put a break
and check the value.

Thanks for any ideas on this.

Note that I added new lines from the original post, but the problem exists
regardless of that.

God Bless,

Mark A. Sam
 
M

Mark A. Sam

Some lines weren't there and I didn't notice. I may have forgot to save
changes and lost them
 

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