469,574 Members | 1,662 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,574 developers. It's quick & easy.

Which form is the "Current Form"?

MLH
Suppose that code running on FormB
is moving the focus around on FormA
to various textbox controls on FormA -

Which form is the current form during this process?
Is it FormA, which has the focus. Or is it FormB,
whose code is doing the work?
Jun 16 '06 #1
2 11483
The form with the focus is the current form.

Jun 16 '06 #2
Not sure that "current form" is clear nomenclature.

The form that has the focus is the active form.
You can determine this with:
Screen.ActiveForm.Name
A line of code such as:
RunCommand acCmdSaveRecord
would be applied to the active form.

But each form's module is directly associated with that form, so Me gives
you a reference to the form and its properties, controls, methods, etc. So:
Me.Dirty = False
saves the record in this particular form, whether it has focus or not.

So, if you want to write code that applies to this form (whether it is the
active form or not):
Use Not
=== ===
Me.Filter = ... DoCmd.ApplyFilter ...
DoCmd.Close acForm, Me.Name DoCmd.Close
[any form-specific code] DoCmd.DoMenuItem
Me.RecordsetClone.FindNext DoCmd.FindNext
Me.[Text0].Setfocus DoCmd.GotoControl ...
and so on.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CR**@NorthState.net> wrote in message
news:vm********************************@4ax.com...
Suppose that code running on FormB
is moving the focus around on FormA
to various textbox controls on FormA -

Which form is the current form during this process?
Is it FormA, which has the focus. Or is it FormB,
whose code is doing the work?

Jun 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by John Oliver | last post: by
3 posts views Thread by RR | last post: by
3 posts views Thread by Bob Cohen \(106531\) | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.