Tabs Button question

D

Dave

Access 2003

I have a TabControl added to a form

on a page (Page3) of that tab control I have added a form

There is also a buttom on the page (but not on the form)

I want that button to add a new record to the form

This is what I have tried but I keep getting an error:

Me!Page3.frmAdminInvestorType.InvestorType.SetFocus
DoCmd.GoToRecord , , acNewRec

What am I doing wrong?

Dave
 
R

Rick Brandt

Dave said:
Access 2003

I have a TabControl added to a form

on a page (Page3) of that tab control I have added a form

There is also a buttom on the page (but not on the form)

I want that button to add a new record to the form

This is what I have tried but I keep getting an error:

Me!Page3.frmAdminInvestorType.InvestorType.SetFocus
DoCmd.GoToRecord , , acNewRec

What am I doing wrong?

Dave

Neither the TabControl nor the TabPage is used to reference the subform.
Just refer to it as you would if there were no TabControl on your form.
 
D

Dave

Rick,
Thanks - but I still seem to be having trouble getting focus back on the
subform.

I guess the easiest thing to do would be just put the damn button on the
subform
 
R

Rick Brandt

Dave said:
Rick,
Thanks - but I still seem to be having trouble getting focus back on
the subform.

I guess the easiest thing to do would be just put the damn button on
the subform

Is frmAdminInvestorType the name of the form or the name of the subform
control hosting the form? Often the nmaes are the same, but that is not
guaranteed.

It is also usually the case that you need two lines. One to set focus first
to the subform, followed by a line that sets focus to the desired control on
the subform.
 
D

Dave

It is both.

This seems to work but gives me a "Object Required" error

Me!frmAdminInvestorType.SetFocus
DoCmd.GoToRecord , , acNewRec
InvestorType.SetFocus
 
R

Rick Brandt

Dave said:
It is both.

This seems to work but gives me a "Object Required" error

Me!frmAdminInvestorType.SetFocus
DoCmd.GoToRecord , , acNewRec
InvestorType.SetFocus


Me!frmAdminInvestorType.SetFocus
Me!frmAdminInvestorType.InvestorType.SetFocus
DoCmd.GoToRecord , , acNewRec
 
D

Dave

Thanks Rick,

still getting error "Object doesn't support this property or Method"

Dave
 
D

Dave

Well the error did not invoke the "debugger" so I did not know which line.
So I decided just to comment out one line at a time.
To my surprise commenting out this line:
Me!frmAdminInvestorType.InvestorType.SetFocus

eliminated the error
AND
it seems to work

I think I am good now

Thanks much

Dave
 

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