Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    184

    Unanswered: Using DAO on a BOUND form. Possible???

    Hello everybody, I am trying to use DAO on a bound form but the textboxes on the form lockup whenever I call any of my DAO procedures.

    1) I make a bound form

    2) I set the Form's recordset to my DAO recordset

    Set DAOrs = Me.Recordset (At this point everything works great)

    3) I put a Command button on the form with simple MoveNext Code

    DAOrs.MoveNext
    If DAOrs.EOF Then
    DAOrs.MoveLast
    End If

    Once I click on the MoveNext command button I cannot edit anymore (Navigation still works though). Thank you for any help.
    In abundance of water only the fool is thirsty. Bob Marley.

  2. #2
    Join Date
    Apr 2004
    Location
    Reading, UK
    Posts
    16
    There shouldn't be a problem with what you are tying to do. Which version of Access are you using? I think earlier versions were problematic with binding recordsets to forms.

    The syntax in your message is the wrong way round:

    Set Me.Recordset = rs
    (not set rs = Me.Recordset)

    This definitely works fine in 2000/2002.

    Are you explicitly opening the recordset with an option and type? The default for DAO is dynamic but ADO is read-only so use fully qualified declarations if you have both libraries referenced, e.g. dim rs as DAO.Recordset.
    There is much pleasure to be gained from useless knowledge

  3. #3
    Join Date
    Jan 2004
    Posts
    184
    Thank you for your answer, however I have done it both ways with the same results

    Set Me.Recordset = rs

    or

    set rs = Me.Recordset

    whenever I click on a button with any code referencing my rs i.e.

    rs.MoveNext
    If rs.EOF Then
    rs.MoveLast
    End If

    I can no longer edit the textboxes (they lock up I cannot even write)

    I am using Access 2000.

    Originally posted by sean_fackrell
    There shouldn't be a problem with what you are tying to do. Which version of Access are you using? I think earlier versions were problematic with binding recordsets to forms.

    The syntax in your message is the wrong way round:

    Set Me.Recordset = rs
    (not set rs = Me.Recordset)

    This definitely works fine in 2000/2002.

    Are you explicitly opening the recordset with an option and type? The default for DAO is dynamic but ADO is read-only so use fully qualified declarations if you have both libraries referenced, e.g. dim rs as DAO.Recordset.

  4. #4
    Join Date
    Apr 2004
    Location
    Reading, UK
    Posts
    16
    Only other thing I can think of is the underlying recordsource. Is it based on a table or a query? Can you definitely update the underlying recordsource on its own? Try and mock up a new form with the code below to see if the problem exists for another table.

    Option Compare Database
    Dim rs As DAO.Recordset

    Private Sub cmdBack_Click()
    On Error Resume Next
    rs.MovePrevious
    If rs.BOF Then
    rs.MoveFirst
    End If
    End Sub

    Private Sub cmdFwd_Click()
    On Error Resume Next
    rs.MoveNext
    If rs.EOF Then
    rs.MoveLast
    End If
    End Sub

    Private Sub Form_Open(Cancel As Integer)
    Set rs = currentdb.OpenRecordset("<<table name>>")
    Set Me.Recordset = rs
    End Sub

    Originally posted by rami.haddad
    Thank you for your answer, however I have done it both ways with the same results

    Set Me.Recordset = rs

    or

    set rs = Me.Recordset

    whenever I click on a button with any code referencing my rs i.e.

    rs.MoveNext
    If rs.EOF Then
    rs.MoveLast
    End If

    I can no longer edit the textboxes (they lock up I cannot even write)

    I am using Access 2000.
    There is much pleasure to be gained from useless knowledge

Posting Permissions

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