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

Which form is the "Current Form"?

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

P: n/a
The form with the focus is the current form.

Jun 16 '06 #2

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