T
Tony K
When rebuilding my inventory application it creates a new empty copy of the
Access DB. When creating the first record of my purchase order screen which
has a related table 'Inventory Transactions' as a DataGrid, I receive this
error.
Notes: Drag and Drop used from Data Sources window. Purchase Order in
details view. Inventory Transactions in grid view.
System.Data.OleDb.OleDbException: You cannot add or change a record because
a related record is required in table 'Purchase Orders'. at
......etc.etc.etc.
If I close the form and reopen, the PO record is there, but the Inventory
Transactions data is not there. If I re-enter the Inventory Transactions
data in the grid, everything saves perfectly.
My 'Save' routine is below.
Private Sub Purchase_OrdersBindingNavigatorSaveItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Purchase_OrdersBindingNavigatorSaveItem.Click, SaveToolStripMenuItem.Click
Try
Cursor = Cursors.WaitCursor
Me.Validate()
Me.Purchase_OrdersBindingSource.EndEdit()
Me.Inventory_TransactionsBindingSource.EndEdit()
Me.Purchase_OrdersTableAdapter.Update(Me.Inventory_management_databaseDataSet.Purchase_Orders)
Me.Inventory_TransactionsTableAdapter.Update(Me.Inventory_management_databaseDataSet.Inventory_Transactions)
Me.StatusToolStripStatusLabel.Text = Nothing
Catch ex As Exception
MessageBox.Show(ex.ToString, "Error Saving Purchase Order",
MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
Finally
Cursor = Cursors.Default
End Try
End Sub
How do I debug something like this???
Thanks,
Tony K.
Access DB. When creating the first record of my purchase order screen which
has a related table 'Inventory Transactions' as a DataGrid, I receive this
error.
Notes: Drag and Drop used from Data Sources window. Purchase Order in
details view. Inventory Transactions in grid view.
System.Data.OleDb.OleDbException: You cannot add or change a record because
a related record is required in table 'Purchase Orders'. at
......etc.etc.etc.
If I close the form and reopen, the PO record is there, but the Inventory
Transactions data is not there. If I re-enter the Inventory Transactions
data in the grid, everything saves perfectly.
My 'Save' routine is below.
Private Sub Purchase_OrdersBindingNavigatorSaveItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Purchase_OrdersBindingNavigatorSaveItem.Click, SaveToolStripMenuItem.Click
Try
Cursor = Cursors.WaitCursor
Me.Validate()
Me.Purchase_OrdersBindingSource.EndEdit()
Me.Inventory_TransactionsBindingSource.EndEdit()
Me.Purchase_OrdersTableAdapter.Update(Me.Inventory_management_databaseDataSet.Purchase_Orders)
Me.Inventory_TransactionsTableAdapter.Update(Me.Inventory_management_databaseDataSet.Inventory_Transactions)
Me.StatusToolStripStatusLabel.Text = Nothing
Catch ex As Exception
MessageBox.Show(ex.ToString, "Error Saving Purchase Order",
MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
Finally
Cursor = Cursors.Default
End Try
End Sub
How do I debug something like this???
Thanks,
Tony K.