|
-
October 8th, 2001, 08:31 PM
#1
Adding/Deleting Records in DBgrid
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!
-
October 11th, 2001, 09:12 PM
#2
Re: Adding/Deleting Records in DBgrid
Idea/suggestion anyone?
Our client has already started to use our app, but in a standalone environment, meaning each PC has its own copy of the database, not minding of database conflicts such as record locking. All is well until we encountered this conflict of adding/deleting records in the grid (like the ones I enumerated in my earlier post) when we tried using ODBC to connect to a centralized database. Our problem is how to solve these inconsistencies.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|