vb6 adding new records in access misses out some records

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MostBanyest
    New Member
    • Nov 2009
    • 1

    #1

    vb6 adding new records in access misses out some records

    i am not good in programming and i need help

    i wrote a program in VB6 that uses MS access database, its supposed to save records into a temporary database, when you are happy with the records it copies them to a permanent database, then deletes all contents in the temporary database in order to enter new records, this process is repeated over and over again but, sometimes very fast, when i checked the permanent database i have noticed that i have less records than those entered, through temp database,

    eg suppose i enter 3 records at a time into temporary database 10 times totaling 30 records, in the permanent database i get maybe only 16 0r 20 records, surprisingly the same program is working fine on a pentium 4 PC or on dual core laptop, but on Pentium 3, 500Mhz CPU 128MB ram 4GB Hdd this problem surfaces,

    could it be the machine speed or something can be dane in the code?

    Code:
    Dim rs5 As New ADODB.Recordset
    Dim rs6 As New ADODB.Recordset
    
    With rs5
            If rs5.State = 1 Then Set rs5 = Nothing
    
    rs5.Open "Select * from [TEMDB]", cnn2, adOpenDynamic, adLockPessimistic
    
       CnDBS.BeginTrans
    
            Do While Not .EOF
                    
                    If rs6.State = 1 Then Set rs6 = Nothing
    
                With rs6
                      rs6.Open "Select * from PERMANENTDB", CnDBS, adOpenDynamic, adLockPessimistic
    
    If err.Number = 3021 Then MsgBox "Please Clear (F4) and restart your transaction": Exit Function
                            
                            rs6.AddNew
                            
                                     rs6.Fields(0) = ThisTill & receipt
                                     rs6.Fields(1) = ThisTill
                                     rs6.Fields(2) = Tilluser
                                     rs6.Fields(3) = rs5.Fields(10).Value
                                     rs6.Fields(4) = rs5.Fields(5).Value
                                     rs6.Fields(5) = rs5.Fields(6).Value
                                     rs6.Fields(6) = rs5.Fields(7).Value
    '                   rs6.Update '' I USED TO HAVE UPDATE HERE STILL WITH SAME PROBLEM
    
                End With
                rs5.MoveNext
            Loop
            
    
        rs5.Close
     Set rs5 = Nothing
     
    End With
    
    rs6.Update
    CnDBS.CommitTrans
    at this stage the temporary database is used to print confirmation records that they have been entered then all records are deleted from the temporary database.
    Last edited by Dököll; Nov 5 '09, 06:06 AM. Reason: Code tags, easy read:-)
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Intense! Good job getting it to do that much thus far.... can you set up a timer to control how frequently data get loaded to permanent db...

    Dököll

    Comment

    Working...