Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Posts
    4

    Question Unanswered: Next/Previous Record buttons - DAO to ADO?

    Hi All,
    I have just upgraded an MDB to ADP and I am having a few problems with some VB code I was using.
    On the MDB I had some DAO code that greyed out the 'Previous record' button on the first record and the 'next record' button on the last record (Code1).
    However this does not work because ADPs use ADO instead of DAO.
    Also I am trying to display record numbers, which now does not work with ADO (Code2). Does anyone know how I could alter this to work on my new Access project?
    Thanks a lot guys!

    Stu

    --begin code1--
    Dim rsClone As Recordset
    Set rsClone = Me.RecordsetClone
    If rsClone.Bookmarkable = True Then
    rsClone.Bookmark = Me.Bookmark
    rsClone.MovePrevious
    cmdPrev.Enabled = Not (rsClone.BOF)
    rsClone.MoveNext
    rsClone.MoveNext
    cmdNext.Enabled = Not (rsClone.EOF)
    rsClone.MovePrevious
    End If
    rsClone.Close
    --end code1--

    --begin code2--
    Me!txtCurrent = Me.CurrentRecord
    Me.RecordsetClone.MoveLast
    Me!txtTotal = Me.RecordsetClone.RecordCount
    --end code2--
    Last edited by browsw; 06-27-04 at 19:38.

  2. #2
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    Well, an easy way to handle it is to continue using DAO. Make sure the DAO object library is still referenced (which it probably is) and explicitly dim your variables to the DAO library.

    In other words, change:
    Dim rsClone As Recordset
    to:
    Dim rsClone As DAO.Recordset

    That's the most painless way to convert your code.

    For the recordcount action, you'll have to assign the Recordsetclone to your recordset variable.

    have fun

Posting Permissions

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