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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid writes unfinished new row to table

Status
Not open for further replies.

Bojangles

Programmer
May 27, 2000
32
Please, can anyone tell me how to solve this problem?
The DataGrid always writes a useless record to the database table everytime the ADDNEW ROW receives focus!

It must be a bug. Am I wrong? To be sure I am not the only person who has run across this problem.

Please help.

Thanks,
Bojangles
 
Are the properties for the table fields set to accept NULL. If so, there will be no prompt indicating that no information was entered prompting the grid to roll back.

 
Thanks dburnham for responding. The problem is not that the GRID shows "blank" rows. The problem is that the actual table in the database has the "blank" records. And nothing that I have tried has kept these unwanted "blank" records from being entered to the database table. I have defined the fields so that NONE of them are required, but it still happens.
Thanks again,
Bojangles
 
Change the properties of one of the fields within the table so that at least one of them is required. This should not be a system generated serial field. It will need to be one of the fields that the user adds data to.

David


 
Thanks again dburnham, but I have done that. Yes that keeps the "blank" record from being added, BUT it also causes a message to show when the user moves off of the NEW ROW. For example, if the user wants to click on a previous row in the datagrid, to say, edit that row, the user is not allowed to do that. He gets a message that the required field (in the NEW ROW) is null. And obviously the required field is going to be null if nothing has been entered in the new row. The only thing that has happened is that the NEW ROW has received focus.
The problem is that VB6's datagrid is determined to add a new record to the database table once the ADDNEWROW receives focus. I really appreciate your willingness to help, but the darn thing just seems it is determined to add a new row or give the user a message that the row has not been completed. And this is really rediculous when all the user has done is tab down to the ADDNEWROW.
Thanks,
Bojangles
 
The only thing I have been able to figure out to get around this problem is to go back and delete the unwanted records.

If anyone has a better suggestion, I would be most appreciative.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top