Results 1 to 4 of 4

Thread: Last Record

  1. #1
    Join Date
    Sep 2011

    Unanswered: Last Record

    I have an Access DB that uses forms to enter the data. On one of the forms it has multiple tabs. All the tabs except the one in question have a one to one relationship. On the tab “daily report” it has a one to many relationship. Sometimes when I open the daily report tab, go to the end and add a new day, and when I hit enter or page down it jumps back to the start of the records. Any idea how to always advance to the next or blank record rather than having to page down through the records again. Or if I wanted to page up it should go to the previous day.
    For some reason this does not happen all the time. Generally it is just the first time I start to enter data.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    Tabs don't have relationships. Are you talking about subforms on tabs?
    Have a nice day!

  3. #3
    Join Date
    Sep 2011


    Yes. the subform is from a related table of the DB that has a one to many relationship. Everything works it is just jumping to the first record of the sub form the first time I go into a record and add a new day.

  4. #4
    Join Date
    Aug 2011
    Indianapolis, IN, USA
    I had a similar problem and never could get it to work properly when I updated the form so I set up a command button on the form named "Last Record" and put the following in the button's OnClick event:

    Private Sub cmdLastRecord_Click()
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim intRecCnt As Integer
    Dim varOffSet As Variant
    ' How many records in the table?
    Set db = CurrentDb
    Set rst = db.OpenRecordset("tblTrans", dbOpenTable)
    intRecCnt = rst.RecordCount
    Set rst = Nothing
    Set db = Nothing
    varOffSet = intRecCnt - 18
    ' Move to the last record so the last record is displayed (not necessarily at the bottom of the form)
    ' then move the pointer back to the OffSet so the last record is at the bottom of the form
    ' then move the pointer to the last record
    DoCmd.GoToRecord acDataForm, "frmTransDisplay", acLast
    DoCmd.GoToRecord acDataForm, "frmTransDisplay", acGoTo, varOffSet
    DoCmd.GoToRecord acDataForm, "frmTransDisplay", acLast

    End Sub

    Hmmmm. I just noticed that I forgot my error handling routine in this sub.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts