Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    No current record... (2000 sr 1)

    Why non current record???
    Sub INSERISCI_NDG()

    Dim DB1 As DAO.Database
    Dim RSD1 As DAO.Recordset
    Dim DB As DAO.Database
    Dim RSD As DAO.Recordset

    On Error GoTo ErrHandler

    'SOURCE
    Set DB1 = DBEngine.OpenDatabase("F:ANAGRAFICA.mdb")
    Set RSD1 = DB1.OpenRecordset("ANAGRAFICA1")
    'SOURCE


    'DESTINATION
    Set DB = DBEngine.OpenDatabase("G:ANAGRAFICA.mdb")
    Set RSD = DB.OpenRecordset("ANAGRAFICA1")
    'DESTINATION

    Do While Not RSD1.EOF

    RSD.Edit

    TEST = RSD1("COPE")

    RSD(0) = RSD1(0)
    RSD(1) = RSD1(1)
    RSD(2) = RSD1(2)
    RSD(3) = RSD1(3)
    RSD(4) = RSD1(4)
    RSD(5) = RSD1(5)
    RSD(6) = RSD1(6)
    RSD(7) = RSD1(7)
    RSD(8) = RSD1(8)
    RSD(9) = RSD1(9)
    RSD(10) = RSD1(10)
    RSD(11) = RSD1(11)
    RSD(12) = RSD1(12)
    RSD(13) = RSD1(13)
    RSD(14) = RSD1(14)
    RSD(15) = RSD1(15)
    RSD(16) = RSD1(16)
    RSD(17) = RSD1(17)
    RSD(18) = RSD1(18)
    RSD(19) = RSD1(19)
    RSD(20) = RSD1(20)
    RSD(21) = RSD1(21)
    RSD(22) = RSD1(22)
    RSD(23) = RSD1(23)
    RSD(24) = RSD1(24)

    RSD.Update
    RSD.MoveNext

    Loop

    ExitHandler:

    On Error Resume Next
    RSD.Close
    Set RSD = Nothing
    DB.Close
    Set DB = Nothing
    RSD1.Close
    Set RSD1 = Nothing
    DB1.Close
    Set DB1 = Nothing
    Exit Sub

    ErrHandler:
    MsgBox Err.Description, vbExclamation
    Resume ExitHandler
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: No current record... (2000 sr 1)

    The code will only work correctly if RSD has exactly the same number of records as RSD1. If you want to add records to RSD instead of modifying the existing records, change RSD.Exit to RSD.AddNew.

Posting Permissions

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