Subforms: adding a new record

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

I have a main form which shows Customer details and within the form a
Subform which shows a table of the customers follow-up dates.

On the main form I wish to have a command button that will set the cursor to
add a new entry to the follow-up dates table for the customer.

At present I keep getting " the object "tblfollowupdates subform" is not
open" when I attempt this

Access help says that I can use Gotocontrol action to move to a subform and
then use Gotorecord action.

The code is:
DoCmd.GoToControl "tblfollowupdates subform"
DoCmd.GoToRecord acDataForm, "tblfollowupdates subform", acNewRec

Has anyone got any suggestions where I am going wrong?.

Many thanks

SteveT
 
Steve,

I think it will work if you just drop the reference to the
tblfollowupdates subform form, which the Help is quite correct in
pointing out is not actually open, just displayed within a subform
control on the main form. So...
DoCmd.GoToControl "tblfollowupdates subform"
DoCmd.GoToRecord , , acNewRec

By the way, this is not a macro, it is part of a VBA procedure.

- Steve Schapel, Microsoft Access MVP
 
Steve,

Very many thanks...

It worked first time with your help.

Sorry, I suppose I knew this wasn't a macro but I always end up reading this
group and didn't think of posting to the alternatives.

Steve T.
 
Back
Top