Open database from child form

J

John F.

Hi,
I have a subform and a button that I want to click to enter a new record on
the subform. I've tried the following but it doesn't do anything. When I
click the 'Add New Record' on the bar at the bottom of the subform, it opens
to a new record; this is the action that I want to replicate on my button.
How do I d this?

This is the code that doesn't work:

Private Sub btnAddNewAdmission_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = CurrentDb()
Set rs = db.OpenRecordset("tblAdmitDateLocation")

rs.AddNew
rs.Bookmark = rs.LastModified


Thanks in adavance!

John Fowler.
 
T

Tom van Stiphout

On Sat, 13 Dec 2008 19:27:01 -0800, John F.

Replace all of that with:
RunCommand acCmdRecordsGoToNew

-Tom.
Microsoft Access MVP
 
J

John F.

Thanks, that works great.

john.

Tom van Stiphout said:
On Sat, 13 Dec 2008 19:27:01 -0800, John F.

Replace all of that with:
RunCommand acCmdRecordsGoToNew

-Tom.
Microsoft Access MVP
 

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