By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 3,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

Disabling buttons on parent form when child form is opened

P: n/a
Lyn
Hi,
I hope someone can help.

I have a main form which mostly fills the Access window. In the bottom half
of this form I have a tab control to display various types of data related
to the main form record. In each page of the tab control, there are three
buttons: Add, Update, Delete. Any of these buttons will open another,
smaller form to add, update or delete the related data record.

Originally, I had placed the smaller form such that it covered the main form
buttons. But I was unable to lock the smaller form in place -- for some
reason it seemed to wander around and change size. Setting the Auto Center
and Auto Size properties has effectively locked the smaller form, but it is
now in the centre of the window, uncovering the main form buttons.

To work around this, I have elongated the form so that it is now about the
same height as the main form. It covers the main form buttons but does not
look pretty.

In any case, clicking anywhere in the main form brings the main form in
front of the smaller form, exposing the buttons once again.

I have tried disabling the main form buttons in the smaller form's Current
event, but it seems that even when the smaller form is current, the main
form button which opened it still has focus.

My problem is, of course, to avoid any undefined events that could occur if
one of these main form buttons is inadvertently clicked when one of them has
already been clicked to open the smaller form.

I am using Win XP and Access 2003.

What I really want to do is disable the main form buttons (or the whole main
form if necessary) when the smaller secondary form is open, then re-enable
them when the smaller form is closed. Whatever I try, Access won't let me
do it.

Any ideas greatly appreciated.

--
Cheers,
Lyn.
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Lyn wrote:
[...]
What I really want to do is disable the main form buttons (or the
whole main form if necessary) when the smaller secondary form is
open, then re-enable them when the smaller form is closed. Whatever
I try, Access won't let me do it.


You could open the child form modal then it's impossible to click something
on the main form until the chlid is closed again.

Another way is to disable the button(s). To do so write in the child's code:
me!parent![NameOfButtonToDisable].enabled=false but before you can do this
you have to make sure that this button does not have the focus:
me![parent]![NameOfSomeOtherControl].setfocus

HTH,
Stefan
Nov 13 '05 #2

P: n/a
I agree with Stefan that what you probably want is to make the secondary forms
modal.

In addition, when the same buttons are used on multiple tabs, it's usually
better to put them below the tabl control on the main form, and have them
behave differently depending which tab is selected.

You can determine which tab is selected by comparing the .Value of the tab
control to the .PageIndex of each page control, usually by using a switch
statement. If you need some buttons to be disabled for some tabs, change the
button enabling properties via the tab control's Change event handler.

On Tue, 14 Dec 2004 17:56:41 +1100, "Lyn" <lh******@ihug.com.au> wrote:
Hi,
I hope someone can help.

I have a main form which mostly fills the Access window. In the bottom half
of this form I have a tab control to display various types of data related
to the main form record. In each page of the tab control, there are three
buttons: Add, Update, Delete. Any of these buttons will open another,
smaller form to add, update or delete the related data record.

Originally, I had placed the smaller form such that it covered the main form
buttons. But I was unable to lock the smaller form in place -- for some
reason it seemed to wander around and change size. Setting the Auto Center
and Auto Size properties has effectively locked the smaller form, but it is
now in the centre of the window, uncovering the main form buttons.

To work around this, I have elongated the form so that it is now about the
same height as the main form. It covers the main form buttons but does not
look pretty.

In any case, clicking anywhere in the main form brings the main form in
front of the smaller form, exposing the buttons once again.

I have tried disabling the main form buttons in the smaller form's Current
event, but it seems that even when the smaller form is current, the main
form button which opened it still has focus.

My problem is, of course, to avoid any undefined events that could occur if
one of these main form buttons is inadvertently clicked when one of them has
already been clicked to open the smaller form.

I am using Win XP and Access 2003.

What I really want to do is disable the main form buttons (or the whole main
form if necessary) when the smaller secondary form is open, then re-enable
them when the smaller form is closed. Whatever I try, Access won't let me
do it.

Any ideas greatly appreciated.


Nov 13 '05 #3

P: n/a
Lyn
Thanks Guys,
I think that Modal is what I am looking for. It is a property whose
function is not obvious from its name, but it seems to meet the
requirements. I will let you know how I go with it.

I hadn't though of having one set of buttons for all pages. I have been
developing and designing the pages as I go (not good practice, I know), so
the current format has just grown. The first two pages written don't need
any of these buttons, so that probably set me on the present track.
However, I suppose I could hide a common set of buttons when those pages are
selected. I will have a look at this option also.

Thanks again for your quick response.
--
Cheers,
Lyn.

"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:ok********************************@4ax.com...
I agree with Stefan that what you probably want is to make the secondary
forms
modal.

In addition, when the same buttons are used on multiple tabs, it's usually
better to put them below the tabl control on the main form, and have them
behave differently depending which tab is selected.

You can determine which tab is selected by comparing the .Value of the tab
control to the .PageIndex of each page control, usually by using a switch
statement. If you need some buttons to be disabled for some tabs, change
the
button enabling properties via the tab control's Change event handler.

On Tue, 14 Dec 2004 17:56:41 +1100, "Lyn" <lh******@ihug.com.au> wrote:
Hi,
I hope someone can help.

I have a main form which mostly fills the Access window. In the bottom
half
of this form I have a tab control to display various types of data related
to the main form record. In each page of the tab control, there are three
buttons: Add, Update, Delete. Any of these buttons will open another,
smaller form to add, update or delete the related data record.

Originally, I had placed the smaller form such that it covered the main
form
buttons. But I was unable to lock the smaller form in place -- for some
reason it seemed to wander around and change size. Setting the Auto
Center
and Auto Size properties has effectively locked the smaller form, but it
is
now in the centre of the window, uncovering the main form buttons.

To work around this, I have elongated the form so that it is now about the
same height as the main form. It covers the main form buttons but does
not
look pretty.

In any case, clicking anywhere in the main form brings the main form in
front of the smaller form, exposing the buttons once again.

I have tried disabling the main form buttons in the smaller form's Current
event, but it seems that even when the smaller form is current, the main
form button which opened it still has focus.

My problem is, of course, to avoid any undefined events that could occur
if
one of these main form buttons is inadvertently clicked when one of them
has
already been clicked to open the smaller form.

I am using Win XP and Access 2003.

What I really want to do is disable the main form buttons (or the whole
main
form if necessary) when the smaller secondary form is open, then re-enable
them when the smaller form is closed. Whatever I try, Access won't let me
do it.

Any ideas greatly appreciated.

Nov 13 '05 #4

P: n/a
On Tue, 14 Dec 2004 21:54:13 +1100, "Lyn" <lh******@ihug.com.au> wrote:
Thanks Guys,
I think that Modal is what I am looking for. It is a property whose
function is not obvious from its name, but it seems to meet the
requirements. I will let you know how I go with it.

I hadn't though of having one set of buttons for all pages. I have been
developing and designing the pages as I go (not good practice, I know), so
Well, you can say it's not good practice all you want - that's how most Access
UIs end up being developed. That's OK so long as one egages the mind and
tries to think of ways to improve the design as you go.
the current format has just grown. The first two pages written don't need
any of these buttons, so that probably set me on the present track.
However, I suppose I could hide a common set of buttons when those pages are
selected. I will have a look at this option also.


In that case, it would almost make sense to do what you've been doing, but
visually, it's nice if common buttons always show and always in the same
place, and disabled when not in context. Changing the UI to have this
consistency also tends to bring to light ways the UI metaphor can be made even
more consistent, using some of the buttons for things now done with other
selections.

Nov 13 '05 #5

P: n/a
Lyn
Thanks for the additional comments. I have tried using the Modal property
and it does everything I want. However I may also still try disabling the
buttons when the smaller form is open -- to avoid the confusion of having a
set of unusable (at that time) buttons looking as though they can be used,
especially as the smaller form will have its own buttons that the user will
be looking for.

I thought I would also try the related Popup property which I hadn't used
before. This caused a bit of panic when I found that I couldn't get back
into design mode! I eventually did (via the database window), and promptly
turned it back off again!

--
Cheers,
Lyn.

"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:rb********************************@4ax.com...
On Tue, 14 Dec 2004 21:54:13 +1100, "Lyn" <lh******@ihug.com.au> wrote:
Thanks Guys,
I think that Modal is what I am looking for. It is a property whose
function is not obvious from its name, but it seems to meet the
requirements. I will let you know how I go with it.

I hadn't though of having one set of buttons for all pages. I have been
developing and designing the pages as I go (not good practice, I know), so


Well, you can say it's not good practice all you want - that's how most
Access
UIs end up being developed. That's OK so long as one egages the mind and
tries to think of ways to improve the design as you go.
the current format has just grown. The first two pages written don't need
any of these buttons, so that probably set me on the present track.
However, I suppose I could hide a common set of buttons when those pages
are
selected. I will have a look at this option also.


In that case, it would almost make sense to do what you've been doing, but
visually, it's nice if common buttons always show and always in the same
place, and disabled when not in context. Changing the UI to have this
consistency also tends to bring to light ways the UI metaphor can be made
even
more consistent, using some of the buttons for things now done with other
selections.

Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.