Results 1 to 1 of 1
  1. #1
    Join Date
    Jun 2006
    Posts
    3

    Unanswered: recordset doesnt work

    Can anyone help me out with this please.

    I always got an empty recordset with linked tables. I'm using DataDirect 4.2 Sybase Wire Protocol driver to linked table via MS Access 2003. I needed to update the data. It worked fine before when I linked these tables from another database locally but doesn't work when i moved all the table to Sybase. I have a form to navigate thru those records (queries with join) and a subform that display the the table that I wanted to update. Everytime I updated the current record in the subform, an event afterupdate will be execute the following codes to update the data. Please let me know what 's wrong with the code. Each tables do have a primary key.

    --start code---
    Dim t_master_sql_1 As String
    Dim sql As String
    Dim sql2 As String
    Dim r_sla As DAO.Recordset
    Dim db As Database
    Set db = CurrentDb

    sql = " SELECT table1.ID, table1.field2, table1.field3, table1.field4, table2.field2, table2.field3, table3.field3 FROM table1, table2, table3
    WHERE table1.ID = " & currentID
    AND table1.field2 = table2.field2
    AND table1.fiedl3 = table3.field3

    Set r_sla = CurrentDb.OpenRecordset(t_master_sql_1)
    If r_sla.RecordCount = 0 Then
    Exit Sub
    Else
    Do calculation here to get result.....

    t_master_sql_2 = "UPDATE table1 SET field4 = '" & result &"'"

    DoCmd.SetWarnings False
    DoCmd.RunSQL t_master_sql_2
    DoCmd.SetWarnings True

    Me.Requery
    End If
    ----end code----

    my r_sla is zero but there should be one record in it. Before these tables moved to Sybase the recordset worked great.
    Last edited by tuyetbang; 07-26-06 at 08:09.

Posting Permissions

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