Automating Processes using Forms

G

Greg

I was wondering if it was possible, using a form, to open up another form and
have it automatically pop-up the Ctrl+F feature.

And if possible, how?
 
K

Klatuu

Yes it is.
Use the Form's Load event. First you want to set the focus to the control
you want to use in the Find because the Find dialog will open with that
control autmatically selected. So the sequence is:

Me.txtSomeControl.SetFocus
Docmd.RunCommand acCmdFind
 
L

Linq Adams via AccessMonster.com

If you want the second form to always open and popup the Find box

Private Sub Form_Load()
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
End Sub

To insure the Find box pops up for the correct field:


Private Sub Form_Load()
Me.DesiredField.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
End Sub
 
K

Klatuu

The DoMenuItem command is obsolete. Help will tell you it is only there for
backward compatibility. You should use the RunCommand going forward.

It is also much easier to understand what the code is actually doing.
 
Top