Results 1 to 7 of 7

Thread: database can move first for the second times??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    20
    sorry about the topic it should be "can't " not "can" :þ
    I was using the DAO 3.6 database, to begin a search i move my recordset to the first one using the command data1.recordset.movefirst, it's work for the first time. but the when the command is use again for the second time it return and error, why??? How can i solve this problem?

  2. #2
    Lively Member
    Join Date
    Jul 1999
    Posts
    78

    Where you want the MoveFirst Method do this:

    If rst.BOF = False then MoveFirst

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    20

    still have problem?

    yeah, i have use the the If rst.BOF = False then MoveFirst
    method before in this way: but it still giving the same result - give the error message.

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    This code works fine with DAO 3.6 & Access 2000 db:

    Code:
        Dim db As Database
        Dim rs As Recordset
        
        Set db = DBEngine.OpenDatabase("Nwind2k.mdb")
        
        Set rs = db.OpenRecordset("Select * from Customers")
        
        Debug.Print rs.Fields(0).Value
        rs.MoveFirst
        rs.MoveNext
        rs.MoveNext
        
        Debug.Print rs.Fields(0).Value
        rs.MoveFirst
        rs.MoveNext
        rs.MovePrevious
        Debug.Print rs.Fields(0).Value
        
        rs.MoveFirst
        rs.MoveFirst
        Debug.Print rs.Fields(0).Value
    What does your code look like?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    20
    First i put some data from the db to a combo box(not link to the db), after that the user can key in or click the combobox list to enter the choice. so the rs have move first twice, first time so get the data to put to the combo box second time is when the user choice the input. I'm was using the code almost same like john, just i'm using
    "If Not rst.BOF Then rst.movefirst".

  6. #6
    Lively Member
    Join Date
    Feb 1999
    Location
    Leicester, UK
    Posts
    123
    What sort of recordset do you have. Is it forward-only?

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    20
    Sorry for my late reply Michael, i'm not sure about the forward-only thing, but i have find out that this problem just occur in the current form, so may be there is some coding problem some way in my form thats make this happen, i'm still checking the source code. Any suggestion?

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