Connecting Tech Pros Worldwide Forums | Help | Site Map

vb6 adding new records in access misses out some records

Newbie
 
Join Date: Nov 2009
Posts: 1
#1: 3 Weeks Ago
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?

Expand|Select|Wrap|Line Numbers
  1. Dim rs5 As New ADODB.Recordset
  2. Dim rs6 As New ADODB.Recordset
  3.  
  4. With rs5
  5.         If rs5.State = 1 Then Set rs5 = Nothing
  6.  
  7. rs5.Open "Select * from [TEMDB]", cnn2, adOpenDynamic, adLockPessimistic
  8.  
  9.    CnDBS.BeginTrans
  10.  
  11.         Do While Not .EOF
  12.  
  13.                 If rs6.State = 1 Then Set rs6 = Nothing
  14.  
  15.             With rs6
  16.                   rs6.Open "Select * from PERMANENTDB", CnDBS, adOpenDynamic, adLockPessimistic
  17.  
  18. If err.Number = 3021 Then MsgBox "Please Clear (F4) and restart your transaction": Exit Function
  19.  
  20.                         rs6.AddNew
  21.  
  22.                                  rs6.Fields(0) = ThisTill & receipt
  23.                                  rs6.Fields(1) = ThisTill
  24.                                  rs6.Fields(2) = Tilluser
  25.                                  rs6.Fields(3) = rs5.Fields(10).Value
  26.                                  rs6.Fields(4) = rs5.Fields(5).Value
  27.                                  rs6.Fields(5) = rs5.Fields(6).Value
  28.                                  rs6.Fields(6) = rs5.Fields(7).Value
  29. '                   rs6.Update '' I USED TO HAVE UPDATE HERE STILL WITH SAME PROBLEM
  30.  
  31.             End With
  32.             rs5.MoveNext
  33.         Loop
  34.  
  35.  
  36.     rs5.Close
  37.  Set rs5 = Nothing
  38.  
  39. End With
  40.  
  41. rs6.Update
  42. CnDBS.CommitTrans
  43.  
  44.  
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.

Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,268
#2: 3 Weeks Ago

re: vb6 adding new records in access misses out some records


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
Reply


Similar Visual Basic 4 / 5 / 6 bytes