473,373 Members | 1,117 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,373 software developers and data experts.

Disabling buttons on parent form when child form is opened

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
5 5013
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Omar Llanos | last post by:
I have Form1 and Form2 (which is inherited from Form1), and I created a button in Form2 that will fill up a textbox in Form1. What code would do that? I tried the simplest way: //from child...
0
by: RT | last post by:
Hi, I am new to vb .net. How do I access a parent menu from a a child form? I want to enable the parent menu item when the child form is closed. Thanks. RT
0
by: Ben | last post by:
Please excuse if this ends up being a double post at some point. I tried posting using another website which crashed, so I am not sure if it will ever get posted. As such I decided to try again...
3
by: jimcolli | last post by:
I have a parent form with a menu button that has a handler. I want to call this same handler when a button on a child form is clicked. I have this simplified code in the main form's Load...
2
by: dchman | last post by:
I have a C# app in VS2005. the form has a datetime picker with valuechanged event. When the form closes, the valuechanged event is fired and an error is thrown in its code when it tries to get a...
9
by: cybervegan | last post by:
Hi, First, the background info: I have a parent form, New_Jobcard that contains a combo-box to select Cust_ID. The combobox shows customers sorted by name and address, like this: Cust_ID V ...
2
by: vidhyapriya | last post by:
is it possible to deactivate parent window form when child window form active if so,can u give some idea or coding about this....i m using vb.net window appln
1
by: ramkarthik99 | last post by:
am really confused in designing a MDI parent form and Child form. help me out
2
by: =?Utf-8?B?U2FpbXZw?= | last post by:
Hi and Hello. Im new at .net framework. Now Im using C# . I have a little problem. How can I get a value of a text in the mdi parent form to child form. Example in VB6: form1.text1.text =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.