M
Max-EC
I have a VB6 apps that use an old MDB (Access 2.0 [1993]) with DAO 3.51
With XP all run perfect, but with Vista I have this problem:
when I insert many records in a table with a recordset opne in "Table" mode,
just after I call "AddNew" method into the fields I find yet the value I
insert in the previous record instead an empty value (or the default value).
Worst, when I call Update method those value is write down into the table.
Obviously the problem is visible only when some fields is not filled.
I try with a test program, and I get same result in interpreted mode (VB6),
but the compiled version seem run OK also in Vista. My original application
instead have the problem also compiled.
Here is the test code:
Private Sub Form_Load()
Dim dbFile As Database
Dim recTable As Recordset
Set dbFile = OpenDatabase(App.Path & "\DbAddNew.mdb")
Set recTable = dbFile.OpenRecordset("Table", dbOpenTable)
recTable.Index = "PrimaryKey" 'ID
dbFile.Execute "DELETE FROM
"
'first record
recTable.AddNew
recTable("ID") = 1
recTable("Field1") = "A"
recTable("Field2") = "B"
recTable("Test1") = "HHHH"
recTable("Test2") = "KKKK"
recTable.Update
'second record
recTable.AddNew
recTable("ID") = 2
recTable("Field1") = "CC"
recTable("Field2") = "DD"
'don't fill the filed TEST1, I expect empty
MsgBox "" & recTable("Test1")
recTable.Update
recTable.Close
dbFile.Close
End Sub
With Vista the messagge box show 'HHHH', with XP show empty
Anybody have an idea how to solve the problem (obviously without rewrite the
apps) or why those happen ?
Furthermore if the problem is due to Vista, DAO or Access 2.0 format ?
Tanks for your patience
Massimo
With XP all run perfect, but with Vista I have this problem:
when I insert many records in a table with a recordset opne in "Table" mode,
just after I call "AddNew" method into the fields I find yet the value I
insert in the previous record instead an empty value (or the default value).
Worst, when I call Update method those value is write down into the table.
Obviously the problem is visible only when some fields is not filled.
I try with a test program, and I get same result in interpreted mode (VB6),
but the compiled version seem run OK also in Vista. My original application
instead have the problem also compiled.
Here is the test code:
Private Sub Form_Load()
Dim dbFile As Database
Dim recTable As Recordset
Set dbFile = OpenDatabase(App.Path & "\DbAddNew.mdb")
Set recTable = dbFile.OpenRecordset("Table", dbOpenTable)
recTable.Index = "PrimaryKey" 'ID
dbFile.Execute "DELETE FROM
'first record
recTable.AddNew
recTable("ID") = 1
recTable("Field1") = "A"
recTable("Field2") = "B"
recTable("Test1") = "HHHH"
recTable("Test2") = "KKKK"
recTable.Update
'second record
recTable.AddNew
recTable("ID") = 2
recTable("Field1") = "CC"
recTable("Field2") = "DD"
'don't fill the filed TEST1, I expect empty
MsgBox "" & recTable("Test1")
recTable.Update
recTable.Close
dbFile.Close
End Sub
With Vista the messagge box show 'HHHH', with XP show empty
Anybody have an idea how to solve the problem (obviously without rewrite the
apps) or why those happen ?
Furthermore if the problem is due to Vista, DAO or Access 2.0 format ?
Tanks for your patience
Massimo