open other form and set focus

  • Thread starter Thread starter Angi
  • Start date Start date
A

Angi

My Contact entry form has 2 pages. Page 2 is info for the home office
(ho). I have a seperate form to view ho info. I've created an Edit
button on the view form. If the user wants to edit the ho, I want it
to open the entry form and go to page 2. I tried setting the Where to

"[ContactID]=" & Me![ContactID] AND [txtHO].SetFocus

but I'm getting a compile error. Is it possible to do this?
 
It's not working because you're trying to do two completely different things
in one command. The docmd.openform opens the form (at a specific record in
your case), while the setfocus tells Access what to do *after* the form has
opened. You just need to break it down into two separate lines....

docmd.openform "YourForm" 'plus where clause
forms!YourForm!txtho.setfocus
 
ok, that didn't do what I was hoping it would do. It did set the
focus, but it's halfway between page 1 and page 2. decided to use

docmd.gotopage 2

Thanks for you help. It led me in the right direction!
 
Back
Top