Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005

    Unanswered: Updating to ADO Recordset

    Newbie to SQL Server here.

    I'm opening a Access 2003 form with a ADO recordset with the following code;

    Function SetFloaterDataSource()

    Dim RecSourceFloater As String
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset

    RecSourceFloater = "SELECT tbl_UserVarHSTUFloatStatByEelink.* " _
    & "From tbl_UserVarHSTUFloatStatByEelink " _
    & "WHERE (((tbl_UserVarHSTUFloatStatByEelink.idCalendar)=" & MyTSCalcIdCal & "));"

    'Use the ADO connection that Access uses
    Set cn = CurrentProject.AccessConnection

    'Create an instance of the ADO Recordset class, and
    'set its properties
    Set rs = New ADODB.Recordset
    With rs
    Set .ActiveConnection = cn
    .Source = RecSourceFloater
    .LockType = adLockOptimistic
    .CursorType = adOpenKeyset
    .CursorLocation = adUseServer
    End With

    'Set the form's Recordset property to the ADO recordset
    Set WeekDay.Form.Recordset = rs

    Set rs = Nothing
    Set cn = Nothing

    End Function

    When I edit the form I noticed that I could not go back to a recently added record because it was not available, so I concluded that I had to force an update, which I do in the before update event of my form, as follows;

    'Update the underlying recordset

    It works great on my test server here, but when I instal it on the SQL Server 2000 - I get an error 'EOF' or 'BOF' is true......... so it fails

    Any thougths?

  2. #2
    Join Date
    Jan 2005

    Never Mind - I figured it out....

    Evidently an ADO recordset as I opened it is Read Only

    I found my solution on the Microsoft MSDN site, check it out;;en-us;227053

    Thnks to all who read this.......

Posting Permissions

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