Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid Control In VB 6 Abends When Adding New Row

Status
Not open for further replies.

DJPavlik

Programmer
Jun 14, 2002
6
US
Good Evening,

We have a DataGrid Control with the DataSource set to an ADO Data Control (ADODC). AllowAddNew, AllowDelete & AllowUpdate are all set to True. There are 5 columns.
The ADODC is connected to an Access table using a Microsoft.Jet.OleDb.4.0 connection string.

If a user positions to the new record (i.e. the record asterisked on the "bottom" of this list), they must enter at least one column of data. If they do not enter at least one column of data, the following message box is displayed when the user attempts to postion the cursor to another row.

"Microsoft DataGrid Control. Empty row cannot be inserted. Row must have at least one column value set. OK (button)"

This is inconveniant when the user accidently positions to the "add record" row.

Is there anyway around this problem?

Thank you.
 
There is a DataGrid1_Error event.
here you can capture the error and set the Response to 0.
Then Inform the user what you want, and cancel the add, by using the recordset method: CancelBatch, and the issue a MoveFirst and a MoveLast

The user can Press ESC to cancel the update as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top