chirpyform
Programmer
I am currently working with Access 2000 and have in my database the code below which imports the data from another database. However, I import 2300 lignes into the table (with the key of the table at 2300) but the automatic numbering offers me 1700 as the next number. This obviously causes problems because this identifiant already exists. If I delete all the lignes with an identifiant greater than 1700 Access continues normally.
This happens in only one table and didn't happen when I worked with Access 97.
Can anyone help please ??
For Each TableSel In ListeSel.ItemsSelected
strOut = ""
NomTable = ListeSel.ItemData(TableSel)
Set RecSet = db.OpenRecordset(NomTable)
Set RecSetImport = DbImport.OpenRecordset(NomTable)
If RecSetImport.RecordCount <> 0 Then
var = RecSetImport.GetRows(RecSetImport.RecordCount)
NbCol = UBound(var, 1) + 1
NbLigne = UBound(var, 2) + 1
Cpt1 = 0
Cpt2 = 0
While Cpt1 < NbLigne
RecSet.AddNew
While Cpt2 < NbCol
RecSet.Fields(Cpt2) = var(Cpt2, Cpt1)
Cpt2 = Cpt2 + 1
Wend
RecSet.Update
Cpt1 = Cpt1 + 1
Cpt2 = 0
Wend
End If
Print #Numlog, strOut
Next TableSel
This happens in only one table and didn't happen when I worked with Access 97.
Can anyone help please ??
For Each TableSel In ListeSel.ItemsSelected
strOut = ""
NomTable = ListeSel.ItemData(TableSel)
Set RecSet = db.OpenRecordset(NomTable)
Set RecSetImport = DbImport.OpenRecordset(NomTable)
If RecSetImport.RecordCount <> 0 Then
var = RecSetImport.GetRows(RecSetImport.RecordCount)
NbCol = UBound(var, 1) + 1
NbLigne = UBound(var, 2) + 1
Cpt1 = 0
Cpt2 = 0
While Cpt1 < NbLigne
RecSet.AddNew
While Cpt2 < NbCol
RecSet.Fields(Cpt2) = var(Cpt2, Cpt1)
Cpt2 = Cpt2 + 1
Wend
RecSet.Update
Cpt1 = Cpt1 + 1
Cpt2 = 0
Wend
End If
Print #Numlog, strOut
Next TableSel