daneb
October 8th, 2001, 08:31 PM
Hi.
I have a form with a DBGrid, named DBGrid1, populated by an Access 97 table data through a Data Control, named Data1. The DBGrid allows deletion and update of records. My questions are as follow:
1) During record deletion
a) If I delete all records displayed in the DBGrid and start to type a value on a column for a new record/row, when I get off that particular row, I get this error: "Data access error". The DataError number as registered in the DBGrid1_Error event is 3607. It seems that the dbgrid doesn't recognize yet that all of its records are gone.
b) If I delete the very last record in the grid, all records disappear, as if I have deleted all of them. When I close my form and reload it, the rest of the records are there.
2) During adding of records
If I add a new record at the bottom of the grid, as soon as I get off that row, the new record disappears.
I experience items #1b and #2 only if I have the following property settings for my DataControl:
DatabaseName : [my ODBC name]
DefaultCursorType : 1 - ODBCCursor
DefaultType : 1 - Use ODBC
But there was no conflict if I have these original settings:
DatabaseName : [path to my database]
DefaultCursorType : 0 - DefaultCursor
DefaultType : 2 - Use Jet
I encounter the error in item #1a if I have the ODBC settings. If I have the original settings, the new record just disappears, as if I didn't add something. But if I close the form and reload it, there is the record that I just added.
I have the following line in my DBgrid's AfterUpdate and AfterDelete events:
DBGrid1.Refresh
but this doesn't seem to help. Why does the DBGrid behave inconsistently? Can anyone shed some light on this? Thanks!
I have a form with a DBGrid, named DBGrid1, populated by an Access 97 table data through a Data Control, named Data1. The DBGrid allows deletion and update of records. My questions are as follow:
1) During record deletion
a) If I delete all records displayed in the DBGrid and start to type a value on a column for a new record/row, when I get off that particular row, I get this error: "Data access error". The DataError number as registered in the DBGrid1_Error event is 3607. It seems that the dbgrid doesn't recognize yet that all of its records are gone.
b) If I delete the very last record in the grid, all records disappear, as if I have deleted all of them. When I close my form and reload it, the rest of the records are there.
2) During adding of records
If I add a new record at the bottom of the grid, as soon as I get off that row, the new record disappears.
I experience items #1b and #2 only if I have the following property settings for my DataControl:
DatabaseName : [my ODBC name]
DefaultCursorType : 1 - ODBCCursor
DefaultType : 1 - Use ODBC
But there was no conflict if I have these original settings:
DatabaseName : [path to my database]
DefaultCursorType : 0 - DefaultCursor
DefaultType : 2 - Use Jet
I encounter the error in item #1a if I have the ODBC settings. If I have the original settings, the new record just disappears, as if I didn't add something. But if I close the form and reload it, there is the record that I just added.
I have the following line in my DBgrid's AfterUpdate and AfterDelete events:
DBGrid1.Refresh
but this doesn't seem to help. Why does the DBGrid behave inconsistently? Can anyone shed some light on this? Thanks!