Results 1 to 2 of 2

Thread: Simple movenext problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Location
    Sydney, Australia
    Posts
    118

    Simple movenext problem

    I'm sure there's a simple answerto this problem, but I cant figure it out. I'm just trying to move to the next current record in my database, but instead, this code just moves to the 2nd record and then does nothing, no matter how many times I click on the movenext button. I read another post somewhere that I'm probably opening the database each time I click the button and it just moves to the 2nd record.
    Can anyone help me with this problem please?

    VB Code:
    1. Set dbsNorthwind = OpenDatabase("C:\Program Files\DevStudio\VB\ZTest5.mdb")
    2. Set rstEmployees = dbsNorthwind.OpenRecordset("Players", dbOpenDynaset)
    3. strSQL = "SELECT * FROM Players "
    4. 'dbsNorthwind.Execute strSQL
    5.  
    6. With rstEmployees
    7.  
    8.     .MoveNext
    9.  
    10. End With
    11.  
    12.     lblName.Caption = rstEmployees.Fields("PlayerName").Value

    Thanks,

  2. #2
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    It seems you are!

    I would separate the code put this part:
    VB Code:
    1. Set dbsNorthwind = OpenDatabase("C:\Program Files\DevStudio\VB\ZTest5.mdb")
    2. Set rstEmployees = dbsNorthwind.OpenRecordset("Players", dbOpenDynaset)
    3. strSQL = "SELECT * FROM Players "
    4. 'dbsNorthwind.Execute strSQL

    On form_load event

    And the rest on the movenext button or something!

    later
    b

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