VBA: how to emulate "Insert > New Record" in VBA while Form is open

P

Peter J. Veger

Situation: the form Person shows one of its records.
I want in Form_Person to emulate the same effect as "Insert > New Record"
I cannot find an AcCommand to use in RunCommand.
Is there another (simple) way to insert a new record in the recordset of the
form, starting from the form showing one its records, so that the form now
shows its non-dirty form that can be filled in by the user.

Peter J. Veger, Best Netherlands.
 
D

Dirk Goldgar

Peter J. Veger said:
Situation: the form Person shows one of its records.
I want in Form_Person to emulate the same effect as "Insert > New
Record"
I cannot find an AcCommand to use in RunCommand.
Is there another (simple) way to insert a new record in the recordset
of the form, starting from the form showing one its records, so that
the form now shows its non-dirty form that can be filled in by the
user.

Peter J. Veger, Best Netherlands.

Have you tried

RunCommand acCmdRecordsGoToNew

?
 
D

Dirk Goldgar

Brendan Reynolds said:
DoCmd.GoToRecord , , acNewRec

And then (for A2K and later) there's

Me.Recordset.AddNew

which Marshall Barton (I think) told me about recently.
 
P

Peter J. Veger

Indeed:
[Application.]DoCmd GoToRecord Record:=acNewRec
[Application.]RunCommand acCmdRecordsGoToNew
both work.
"Me.recordset.addNew" works for .mdb databases on the DAO recordset and I do
not use DAO.
Thank you both...

Peter J. Veger, Best Netherlands.
 

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