Focus set to sub-form when form first opened.

D

Dennis

All,

I'm using Access via XP Office Pro w sp3 on XP Pro w SP3.

I have a unbound form with two sub-forms. The two sub-forms are in tabs.

The top of the main form is used to enter the filter or selection criteria.
The user can enter any or all of the five parameters. When they are done,
the click on the Search Data button. One or more rows of data that meet the
search criteria appear in the first subform (continuous form). The user then
clicks on a row and the first sub-form set's focus on the second sub-form
where the user can edit the data.

The Search Data button generates an SQL statement that is put into the
first's subform's row source. When the user then clicks on a row and the
first sub-form get the key, it requeries the 2nd subform using that key. 2nd
subform's row source is select to select on the key.

Now, here is my problem. When I start the form, everything loads, but the
focus on the main form is set to the first data entry field on the first
sub-form. I've tried putting in break points to figure out how the focus is
getting set to the sub-form, but I have not been able to figure it out.

I want to have the initial focus set to the the first filter / data entry
field / control on the top of the main form. Any idea's how to fix this?
Remember, my main form is unbound. The first sub-form and second sub-forms
are bound to the inventory history table.

Than you for your assitance.
 
J

Jeanette Cunningham

Hi Dennis,
In the form Load event, put this code-->
Me.txtFilterName.SetFocus


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
D

Dennis

Jeanette,

That worked. The bad thing is I knew that. Sorry. I thought I had tried
it, but it was late a night and I was tired and obviously brain damaged at
the time.

You live in a nice city. I was there for about a week back in 1999. Very
nice. Little chilly in the winter thought.

Thanks for you help.
 
J

Jeanette Cunningham

Melbourne is a very livable city, glad I could help.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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