Open 2 forms

J

Jim Orson

Greetings, I want to open 2 forms when the database starts, frm1 & frm2.
Frm1 must be the 1st tab (with the focus) and frm2 must be the 2nd tab
(without the focus). How can I do this? Thanks...
 
T

Tom van Stiphout

On Thu, 16 Jul 2009 05:02:35 -0500, "Jim Orson"

Rather than selecting a form to open in the Startup properties, write
a macro with two lines, using the OpenForm action to open the two
forms, and save that macro with the name AutoExec. When the database
starts it will automatically execute this macro and open your forms.
If you hold down the Shift key while opening the db it will not run
the macro - sometimes convenient for getting in there as a developer.

-Tom.
Microsoft Access MVP
 
J

Jim Orson

Excellent! Thanks Tom. Actually I used 3 lines in the AutoExec macro:

Open form (frm1)
Open form (frm2)
Select object (frm1) <<< this 3rd line puts the focus back to frm1

FYI, I was able to use the Startup properties to open frm2 and then in the
OnOpen property for frm2, I was able to open frm1. This produced the 2 open
forms in the correct tab order (frm1 first, then frm2) in the database
window, BUT the focus was on frm2 and I couldn't for the life of me get the
focus to frm1. SelectObject did not work in this situation. Your method
WORKED!

Jim...
 
T

Tom van Stiphout

On Thu, 16 Jul 2009 08:58:27 -0500, "Jim Orson"

Glad it worked. The two lines:
Open form (frm2)
Open form (frm1)
would probably have worked as well.

-Tom.
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top