473,654 Members | 3,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making a SubForm Modal when it has Focus

My main form has tab-pages. On each tabbed page is a subform control
containing a different subform. When a user selects a specific tab
and begins to edit a record, I need a way of preventing the user from
clicking on another Tab. I don't want to make the other tabs
invisible.

I tried setting the subForm so that the user is in Me.Modal=True
during the edit, but when this happens - everything becomes modal (ie
the MainForm/Subform), everything locks. My intention was to make
just the subform modal.

Any ideas about approaching this issue?

Thanks
Greg

Feb 23 '07 #1
9 3646
On 22 Feb 2007 17:52:06 -0800, "Ap******@gmail .com"
<Ap******@gmail .comwrote:

Why?
Redesign your app so tabbing is supported.

-Tom.
>My main form has tab-pages. On each tabbed page is a subform control
containing a different subform. When a user selects a specific tab
and begins to edit a record, I need a way of preventing the user from
clicking on another Tab. I don't want to make the other tabs
invisible.

I tried setting the subForm so that the user is in Me.Modal=True
during the edit, but when this happens - everything becomes modal (ie
the MainForm/Subform), everything locks. My intention was to make
just the subform modal.

Any ideas about approaching this issue?

Thanks
Greg
Feb 23 '07 #2
Tom

Not sure I understand what you mean. It is designed to support
tabbing.
I'm just not sure how to go about locking the Parent Form Tabs when
someone is committed to an edit in the subForm of one of the tabs. I
see the option of Visible or Enabled in the subform control, but
neither has the desired effect. I'm looking for someway to just lock
the Tabs in code.

Thanks
Greg

Feb 23 '07 #3
On Feb 22, 11:30 pm, "ApexD...@gmail .com" <ApexD...@gmail .comwrote:
Tom

Not sure I understand what you mean. It is designed to support
tabbing.
I'm just not sure how to go about locking the Parent Form Tabs when
someone is committed to an edit in the subForm of one of the tabs. I
see the option of Visible or Enabled in the subform control, but
neither has the desired effect. I'm looking for someway to just lock
the Tabs in code.

Thanks
Greg
I think Tom is suggesting that you redesign it so that it is not an
issue that people move between tabs at any given time. I would agree
that if you need to prevent users from editing in multiple forms, then
thought should be put into why these are on tabs, when separate forms
(not in subforms) would provide the same effect without the extra
effort.

Feb 23 '07 #4
>I think Tom is suggesting that you redesign it so that it is not an
>issue that people move between tabs at any given time.
The only time it will be an issue, is if the user is editing a subform
that is embedded in the tab page. I want to confine the user to that
tabpage until the edit completes. All I want to do is control the Tab,
I know it can be done with Visible & Enabled, is there any other way?
>I would agree that if you need to prevent users from editing in multiple forms, then
thought should be put into why these are on tabs, when separate forms
(not in subforms) would provide the same effect without the extra
effort.
I'm probably doing a bad job of explaining! The parent form has 5-
tabs. 2-tabs contain parent form fields, and the remain 3-tabs
contain subforms that are linked to the parent and make perfect sense
in the scope of the app. The tabs seperate the data nicely. The
subforms are continuous, and have button controls. The problem is that
the user, when in the middle of editing the subform, could reach up
and click on a different Tab and be abruptly yanked out of the tab
they are in.

All I want to do is control the Tab, I know it can be done with
Visible & Enabled, is there any other way?
Thanks
Greg

Feb 23 '07 #5
I figured it out !!!

I placed a condition in the OnExit event of the subForm Control

Thanks
Greg

Feb 23 '07 #6
On 22 Feb 2007 21:08:44 -0800, "Ap******@gmail .com"
<Ap******@gmail .comwrote:

Often when you want to do something against the grain, it gets tough.
I'm sure you could write some VBA to keep track of which tab you're
on, and in the tabcontrol's change event set the tab back to where you
want it to be. For example this in the Change event:
If Me.TabCtl0.Valu e <0 Then Me.TabCtl0.Valu e = 0

Allowing free tabbing is much better. Also note that a subform record
would save automatically when user tabs to another page.
If you're concerned that "user is abruptly yanked out of the tab
they are in", imagine the poor user who is NOT allowed to visit other
tabs when he's in the tab he's in. Going against standard behavior is
not often a good idea.

Now go implement it anyway :-)

-Tom.

>>I think Tom is suggesting that you redesign it so that it is not an
issue that people move between tabs at any given time.

The only time it will be an issue, is if the user is editing a subform
that is embedded in the tab page. I want to confine the user to that
tabpage until the edit completes. All I want to do is control the Tab,
I know it can be done with Visible & Enabled, is there any other way?
>>I would agree that if you need to prevent users from editing in multiple forms, then
thought should be put into why these are on tabs, when separate forms
(not in subforms) would provide the same effect without the extra
effort.

I'm probably doing a bad job of explaining! The parent form has 5-
tabs. 2-tabs contain parent form fields, and the remain 3-tabs
contain subforms that are linked to the parent and make perfect sense
in the scope of the app. The tabs seperate the data nicely. The
subforms are continuous, and have button controls. The problem is that
the user, when in the middle of editing the subform, could reach up
and click on a different Tab and be abruptly yanked out of the tab
they are in.

All I want to do is control the Tab, I know it can be done with
Visible & Enabled, is there any other way?
Thanks
Greg
Feb 23 '07 #7
Allowing free tabbing is much better. Also note that a subform record
would save automatically when user tabs to another page.
I know, and this also applied to a new record being added. This app
uses the
New/Edit/Del button control concept, and prompts at Save or Quit time,
that was why tabbing out disrupted everything.
If you're concerned that "user is abruptly yanked out of the tab
they are in", imagine the poor user who is NOT allowed to visit other
tabs when he's in the tab he's in. Going against standard behavior is
not often a good idea.
Good point, but it only applies when the user is Editing or inserting
a New record, and stands to reason that they should not jump out to
another Tab until they are complete.
At least in this app, that uses the New/Edit/Del and Save/Quit button
concept.
Now go implement it anyway :-)
Of course!

Private Sub subFormControl_ Exit(Cancel As Integer)
DoCmd.Beep
Me.myCurrentTab .SetFocus
End Sub

THANKS Tom
Greg

Feb 23 '07 #8
Ap******@gmail. com wrote:
Good point, but it only applies when the user is Editing or inserting
a New record, and stands to reason that they should not jump out to
another Tab until they are complete.
At least in this app, that uses the New/Edit/Del and Save/Quit button
concept.
The concept you're talking about is a sensible one I've seen in many
good apps (ie, not my own). An example would be in a set up where you
have equipment records and display them one at a time on a tabbed form,
with one of the tabs, for example, being the preventive maintenance
schedule. When you add a new piece of equipment, you *don't* want the
user trying to add PM schedules for a piece of equipment that isn't even
in the equipment table yet.

AFAIK, in Access you can disable a tab - the appearance doesn't change.
In one of my Jet apps, I wanted things to grey out so I added various
tags to different controls and enumerated through them and
enabled/disabled depending on whether the add/edit button was clicked.

Personally, I wouldn't mind just making the tab pages you want to keep
users out of invisible when in add or edit mode.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Feb 23 '07 #9
>Personally, I wouldn't mind just making the tab pages you want to keep
>users out of invisible when in add or edit mode.
I tried this Tim and it works just fine, but the Elimination and
Restore of multiple tabs
on each Edit or new Record became annoying. I simply placed the
following code in the Exit event of the 'subFORM Control' that resides
on the TabPage.

Private Sub subPROMO_Exit(C ancel As Integer)
If pTabLock Then 'Prevent tabbing
DoCmd.Beep
Me.subPROMO.Set Focus 'Keep the focus on my current subForm
Control
End If
End Sub

Works great and no disturbing screen activty.

Thanks
Greg

Feb 23 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
24819
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that contains the subform is named Clients. I have this code in the Add Client btn: If Forms!Clients.subformVisits!VisitDirty = True Then MsgBox "Visit subform is dirty!"
3
3964
by: Uwe Range | last post by:
Hi to all, I am displaying a list of records in a subform which is embedded in a popup main form (in order to ensure that users close the form when leaving it). It seems to be impossible to delete a record in this subform. When I switched modal off and tried to delete a record from the list, I deleted a record on another form (below the popup form).
6
2029
by: Ray | last post by:
I have a main form with a subform. The main form has a combo box which lists all the clients which in turn are displayed in the subform. The subform is bound to the combo box and all work well. however, I would like to be able to add a new client in the subform but this is, of course bound to the combo box. Can anyone tell me if there is a way to enter a new client in the subform with out receiving an error message? TIA - Ray
0
1149
by: (Pete Cresswell) | last post by:
I've got a few subforms, each with an accellerator key assigned. When the user presses, for instance, Alt+2, the focus shifts to subform "2". This works OK once the user has selected a record on the form...then if they hop to another field and back to the form, they can navigate the subform via up/down arrow keys that respond to KeyDown events on the subform. The problem is just after the parent form has opened and the user has yet...
1
3037
by: MP | last post by:
I have a main form that has a subform which also has a subform: the main form is the first subform is the second subform is When I click on the button »AddNewSubSubRecord« (add a new record in the second subform , the code generates the message: Can't find the field »POG-03 Work Subform« reffrred to in your expression.
3
2277
by: Tim Marsden | last post by:
Hi, I have a menu form. The user selects an item from then menu and it shows the maintenance form for the item. This maintenance form is modeless so the user can select another item to edit from then menu at the same time. However from the maintenance from the user can edit properties, this shows a dialog box to edit the value, this form is modal. I want to force the user to close the property dialog before selecting
1
3233
by: google | last post by:
I have a form with several subforms. Users enter the data, then on the parent there is a command button that runs code to generate a .pdf document from a report based on the data they are working with. If a user enters data in a subform, then directly clicks the command button on the parent form, the data in the subform is not included in their document. I THOUGHT that as soon as focus left the subform, any pending changes to the data...
2
2641
by: Mike | last post by:
Hi, I'm having a problem with modal forms on windows. I've written a very short test program, with a main window and a form called from the main window. The form is set to modal with form.setModal(1) before calling form.show(). All works as expected on Linux. The form is modal, not allowing the main window to received the focus. If I call the form from within itself, the topmost form is modal, and not of the previous forms will...
2
3499
by: diogenes | last post by:
I have created many shortcut/popup (aka context, or right-click) menus for my application - instead of toolbars or standard drop-down menus. Within my custom menu, I am using =ShowMainMenu("item") in the On Action event where ShowMainMenu is a public function in frmMain, and "item" is a string mapping to a button click event. (error trapping omitted) Public Function ShowMainMenu(strItem As String) As Boolean
0
8376
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.