Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002
    Location
    Hartford, CT
    Posts
    106

    Unanswered: Checking the last record in a table from a form

    Hi,

    I am trying to display a message for the form user when he/she hits the "Next" button at the last record of the table. The auto message from the access form does not come up until the user hits "Next" one more time after the last record.

    Can you tell me what property should I check for to inform the user that they are at the last record already?

    Thanks
    Mo

  2. #2
    Join Date
    Nov 2002
    Location
    Sweden
    Posts
    14
    Im not sure if this is what you´re looking for but...anyway=)

    Dim db As Database
    Dim rs As Recordset

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

    If Me.CurrentRecord = rs.RecordCount + 1 Then
    MsgBox "Last Record"
    End If
    Sebastian

  3. #3
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    Originally posted by SebastianE
    Im not sure if this is what you´re looking for but...anyway=)

    Dim db As Database
    Dim rs As Recordset

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

    If Me.CurrentRecord = rs.RecordCount + 1 Then
    MsgBox "Last Record"
    End If
    from what he's saying i think that should read (plus i've played with your code slightly)

    Dim rs As DAO.Recordset '(or ADODB access can go haywire if your not explict here)

    Set rs = CurrentDb.OpenRecordset("your_table")

    If Me.CurrentRecord = rs.RecordCount Then MsgBox "Last Record"
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

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