how to open single form displaying last (new) record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I have a form that displays all the fields of a table. By default,
Access opens the form with bookmark on the 1st record. However, I'd like to
have it to display a blank (last) record for a new entry instead. e.g. I
have 3 records in the table. I'll like it to go into the 4th (new blank)
entry when the form is opened.
This is what I've tried
In "on load" event of the form I have the following code:

Me.RecordsetClone.MoveLast
Me.Bookmark = Me.RecordsetClone.Bookmark

when the form opens, it goes to the last record with data (3rd) instead of
the new (non-existing). I'll have to click the next record to get to the
blank one.

Thanks,
 
Hi, Jeff.

Use the GoToRecord method of the DoCmd object

DoCmd.OpenForm "YourForm", acNormal
DoCmd.GoToRecord , , acNewRec

If you *only* want to add new records, and not edit the existing, set the
DataEntry property to Yes.

Hope that helps.
Sprinks
 
Thanks Sprinks.

Sprinks said:
Hi, Jeff.

Use the GoToRecord method of the DoCmd object

DoCmd.OpenForm "YourForm", acNormal
DoCmd.GoToRecord , , acNewRec

If you *only* want to add new records, and not edit the existing, set the
DataEntry property to Yes.

Hope that helps.
Sprinks
 
Back
Top