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

Making a SubForm Modal when it has Focus

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
>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

P: n/a
I figured it out !!!

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

Thanks
Greg

Feb 23 '07 #6

P: n/a
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.Value <0 Then Me.TabCtl0.Value = 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

P: n/a
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

P: n/a
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

P: n/a
>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(Cancel As Integer)
If pTabLock Then 'Prevent tabbing
DoCmd.Beep
Me.subPROMO.SetFocus '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 discussion thread is closed

Replies have been disabled for this discussion.