Command buttons on a tabed page form

M

Michelle

How do you create a "Add New" command button on a form that has a tabed page? What I would like it to do is go to the first field on the first page

Can anyone help?
 
T

tina

if the field you want to go to, and the command button, are both on the main
form - rather than one of them on a subform - just add a procedure to the
command button's OnClick event, as

Private Sub CommandButtonName_Click()

DoCmd.RunCommand acCmdRecordsGoToNew
Me!ControlName.SetFocus

End Sub

substitute the correct command button name and control name, of course.

hth


Michelle said:
How do you create a "Add New" command button on a form that has a tabed
page? What I would like it to do is go to the first field on the first
page.
 
R

r0adhog

In the onclick event of the button do this:

me.tab_name.setfocus

rh

Michelle said:
How do you create a "Add New" command button on a form that has a tabed
page? What I would like it to do is go to the first field on the first
page.
 
M

Michelle

When I run this command it gives me an run-time error 204
"The command or action RecordsGoToNew isn't available now
Why do I get this message

----- tina wrote: ----

if the field you want to go to, and the command button, are both on the mai
form - rather than one of them on a subform - just add a procedure to th
command button's OnClick event, a

Private Sub CommandButtonName_Click(

DoCmd.RunCommand acCmdRecordsGoToNe
Me!ControlName.SetFocu

End Su

substitute the correct command button name and control name, of course

ht


Michelle said:
How do you create a "Add New" command button on a form that has a tabe
page? What I would like it to do is go to the first field on the firs
page
 
T

tina

since you called the button "Add New" , i assumed you wanted to go to a new
record, then to the first field in the record. is that *not* the case? is
your form bound to a table or updateable query? is the form's AllowAdditions
property set to No? are you opening the form as Read Only?
 
M

Michelle

To answer your questions. My form is setup with tabs instead of page breaks (5 tabs). I have the s.s.#, first name and last name fields above the tabs, so they show up each time you go to a different tab. The form is made from a query that contains a couple of tables. Each table is updated each time a new employee is entered. What I would like it to do is go back to the first field (s.s.#) and the first tabed page. So, if I'm on the third tabed page it should go back to the first tabed page and go to the s.s.# field above the tab. Do you have any ideas?
 
T

tina

if the form's underlying query has multiple tables, are you sure the
recordset is updateable? to test it, open the query itself, and try to add a
record. if you can't, then the problem is the query not the form, and you'll
have to re-think your data entry approach.

hth


Michelle said:
To answer your questions. My form is setup with tabs instead of page
breaks (5 tabs). I have the s.s.#, first name and last name fields above
the tabs, so they show up each time you go to a different tab. The form is
made from a query that contains a couple of tables. Each table is updated
each time a new employee is entered. What I would like it to do is go back
to the first field (s.s.#) and the first tabed page. So, if I'm on the
third tabed page it should go back to the first tabed page and go to the
s.s.# field above the tab. Do you have any ideas?
 
Top