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?