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

Run-time Error. Empty row cannot be inserted.

Status
Not open for further replies.

briangi

MIS
Joined
Sep 16, 2002
Messages
4
Location
US
I am very new to VB so I hope this makes sense. I have an application with an adodc control with a connection to a table in a MS SQL 7 database. The application allows users to enter a number value of 1 to 4 for five different questions. The application works fine on all computers but one. When the application is ran on this specific computer, the following error is received when you attempt to update the database.

Run-time error '-2147467259(80004005)'
Empty row cannot be inserted. Row must have at least one column value set.

I have searched the internet and every VB book I have and I don't know where to go from here. Any help would be greatly appreciated.
 
You are trying to insert a record into the table, but all of values are empty.
Check the values just prior to inserting the record (based on what is in the INSERT INTO statement) [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Thanks for your help. The problem is that even when data is typed into the text boxes on the problem computer, it still returns the error message when you try to update the table. The table in sql is set to accept nulls, so as long as one of the five text boxes have data entered, it will update fine on all computers except for the one.
 
Add error handling to the ADO Data Control's Error event procedure. In the form's code window, select from the left drop-down box the data control and in the right drop-down box select the below event and add the code:

Private Sub Adodc1_Error(ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fCancelDisplay As Boolean)

If ErrorNumber = 16389 Then
With Adodc1.Recordset
If .State = ADODB.adStateOpen Then
.CancelUpdate
.MoveLast
fCancelDisplay = True
End If
End With
End If
End Sub
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top