Results 1 to 6 of 6

Thread: Recordset

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Post

    Im not to sure how to code this. If i have two command buttons on a form,one to step foward and one to step back in a table built in access.
    Private Sub Command_ bckClick()
    Customers.Recordset.MovePrevious
    End Sub.
    What is the variable that i have to define? Dim ????? as ??????

    Thanx....

  2. #2
    Member
    Join Date
    Jan 2000
    Location
    Singapore
    Posts
    59

    Post

    Hi,
    first decalre the recordset object
    Dim rst as recordset

    set rst = new recordset
    rst.open "some thing about your conncetion and all"
    if you are moving previous
    first check for BOF
    if rst.BOF then
    msgbox"This is the first record"
    [OR disable the previous button]
    else
    rst.moveprevious
    end if

    if you are moving next
    check for EOF
    if rst.EOF then
    msgbox
    [or disable the next button]
    else
    rst.movenext
    end if

    If you are using datacontrol for this then you don't need to declare.
    You can use datacontro1.recordset.moveprevious or movelast
    But check BOF or EOF first


    Thanks
    karun


    [This message has been edited by karunakaran (edited 02-13-2000).]

  3. #3

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Post

    Thanks for the help. Youre a lifesaver.

    Brandon.

  4. #4

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Post

    One Quick Question. The coding has to be behind the foward and back command buttons.
    So if i have
    Prviate Sub cmdFoward_CLick()
    If rs.EOF Then
    MsgBox ("This is the last Record")
    Else
    rs.MoveNext
    End If
    End Sub
    I get a runtime error '424'Object Required. Everything else is in the Form_Load event (Setting the rs and the db)



  5. #5
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    If you are using just Dim rs As RecordSet in Form_Load() event then it isn't detected anywhere else but in that event (something like that at least ). What you could do is to Dim it in (General) (Declarations) part of your code or use this in a Module: Public rs as Recordset. It should help
    HTH

    ------------------
    Visual Basic Programmer
    ------------------
    PolComSoft
    You will hear a lot about it.


  6. #6
    New Member
    Join Date
    Feb 2000
    Location
    Wanganui
    Posts
    11

    Post

    Instead of putting it in the form_load put it into the form_activate.

    I found that fixed it.

    ------------------
    Tommy Boy.

Posting Permissions

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



Click Here to Expand Forum to Full Width