Tim Bedborough
Registered User.
- Local time
- Today, 16:34
- Joined
- Nov 16, 2015
- Messages
- 42
Hi all
I have a main form and a sub form. The sub form is continuous. I want to add a button in the main form that sets focus on the sub form, goes to the last record in the sub form but shows the last 'x' number of records (can get about 20 in the main form space allocated to the sub form.
The following code unlocks the main form and sub forms (there are 2), then sets the focus on the sub form (subfrmActivityDateOrder) and goes to the last record OK BUT only shows the last record rather than using up the space to show more than 1 continuous record.
Private Sub btnLast_Click()
Me.AllowEdits = True
Me.AllowDeletions = True
Me.AllowAdditions = False
Me.subfrmActivityDateOrder.Enabled = True
Me.subfrmVariationsDateOrder.Enabled = True
Me.subfrmActivityDateOrder.SetFocus
DoCmd.RunCommand acCmdRecordsGoToLast
End Sub
I tried adding me.seltop = me.seltop - 20 but it seemed to identify the main form rather than the sub form.
I tried using the full path name for the sub form (Forms.frmjobs.subfrmActivityDateOrder.) but this created an error.
I can stick with what I have but feels a bit 'unfinished' !
Any thoughts or ideas appreciated please.
Thanks in advance.
I have a main form and a sub form. The sub form is continuous. I want to add a button in the main form that sets focus on the sub form, goes to the last record in the sub form but shows the last 'x' number of records (can get about 20 in the main form space allocated to the sub form.
The following code unlocks the main form and sub forms (there are 2), then sets the focus on the sub form (subfrmActivityDateOrder) and goes to the last record OK BUT only shows the last record rather than using up the space to show more than 1 continuous record.
Private Sub btnLast_Click()
Me.AllowEdits = True
Me.AllowDeletions = True
Me.AllowAdditions = False
Me.subfrmActivityDateOrder.Enabled = True
Me.subfrmVariationsDateOrder.Enabled = True
Me.subfrmActivityDateOrder.SetFocus
DoCmd.RunCommand acCmdRecordsGoToLast
End Sub
I tried adding me.seltop = me.seltop - 20 but it seemed to identify the main form rather than the sub form.
I tried using the full path name for the sub form (Forms.frmjobs.subfrmActivityDateOrder.) but this created an error.
I can stick with what I have but feels a bit 'unfinished' !
Any thoughts or ideas appreciated please.
Thanks in advance.