jumping to the new record problem (continuous form)

mishafljin

New member
Local time
Yesterday, 20:12
Joined
Jan 7, 2016
Messages
8
Hi,

On my form I have a button to create new record.
When I click it, it opens as pop up (continuous). I put in Event on Load code:

Private Sub Form_Load()
Me.RecordsetClone.MoveLast
Me.Form.InsideHeight = (Me.Detail.Height * (Me.RecordsetClone.RecordCount + IIf(Me.AllowAdditions, 1, 0))) + IIf(Me.FormHeader.Visible, Me.FormHeader.Height, 0) + IIf(Me.FormFooter.Visible, Me.FormFooter.Height, 0)
DoCmd.GoToRecord , , acNewRec
End Sub


First part is for not showing the empty space below the new record box (i don't even have a footer), and second part is for jumping to the new record.
It all works well in forms that consist of less than 30 records.
But in forms where i have a lot of data, it shows only blank window with new empty record on the top of it. I must click on scroll bar to move it upwards, to see other records.
Is there a way for jumping to the new empty record which will show on the bottom of the window while the rest of data is visible in the upper part?
 
no need for all that code, just open a dataentry form:

docmd.OpenForm "frmEntry",acNormal,,,acFormAdd
 
Uhhm, can you be more specific? You've meant On Load?
I have tried that but it's not jumping on the new record.
 
untested, please test:

Private Sub Form_Load()
dim rs As Dao.RecordSet
set rs = Me.RecordsetClone
Me.Form.InsideHeight = (Me.Detail.Height * (Me.RecordsetClone.RecordCount + IIf(Me.AllowAdditions, 1, 0))) + IIf(Me.FormHeader.Visible, Me.FormHeader.Height, 0) + IIf(Me.FormFooter.Visible, Me.FormFooter.Height, 0)
rs.MoveLast
Me.Bookmark = rs.Bookmark
DoCmd.GoToRecord , , acNewRec
rs.Close: Set rs=Nothing
End Sub
 
Thank you arnelgp.

The result is blank window showing only last saved record on top + new entry field.
 

Users who are viewing this thread

Back
Top Bottom