J
jwrnana
I have an order entry database (Template from access).
1. Create customer info in form from customer table.
2. Make certain products are in product table/form.
3. Open orders form.
4. Select customer.
5. Go to subform, orders by customer.
6. Enter info in another subform/ order details.
I can enter all of this information -- but when I get to the end of the
orders details subform (entered product, quantity) errors occurs:
You cannot add or change a record because a
related
record is required in table "Orders".
I have entered previous customers with all pertinent information without a
problem. Now I am getting this error. When I select HELP, I get message
about referential integrity/one-to-many relationship. I have not changed
anything. What do I need to do? I have linked the tables products and
orders together. Everything looks okay and I haven't changed anything.
Code Follows:
Private Sub Form_AfterDelConfirm(Status As Integer)
Forms![Orders]![Order Details Subform].Requery
End Sub
Private Sub ProductID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub ProductID_AfterUpdate()
Me![UnitPrice] = Me![ProductID].Column(2)
End Sub
Private Sub ProductID_DblClick(Cancel As Integer)
On Error GoTo Err_ProductID_DblClick
Dim lngProductID As Long
If IsNull(Me![ProductID]) Then
Me![ProductID].Text = ""
Else
lngProductID = Me![ProductID]
Me![ProductID] = Null
End If
DoCmd.OpenForm "Products", , , , , acDialog, "GotoNew"
Me!ProductID.Requery
If lngProductID <> 0 Then Me![ProductID] = lngProductID
Exit_ProductID_DblClick:
Exit Sub
Err_ProductID_DblClick:
MsgBox Err.Description
Resume Exit_ProductID_DblClick
End Sub
I am not very good with codes. Thank you in advance.
My deadline is quickly approaching and I am LOST.
1. Create customer info in form from customer table.
2. Make certain products are in product table/form.
3. Open orders form.
4. Select customer.
5. Go to subform, orders by customer.
6. Enter info in another subform/ order details.
I can enter all of this information -- but when I get to the end of the
orders details subform (entered product, quantity) errors occurs:
You cannot add or change a record because a
related
record is required in table "Orders".
I have entered previous customers with all pertinent information without a
problem. Now I am getting this error. When I select HELP, I get message
about referential integrity/one-to-many relationship. I have not changed
anything. What do I need to do? I have linked the tables products and
orders together. Everything looks okay and I haven't changed anything.
Code Follows:
Private Sub Form_AfterDelConfirm(Status As Integer)
Forms![Orders]![Order Details Subform].Requery
End Sub
Private Sub ProductID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub ProductID_AfterUpdate()
Me![UnitPrice] = Me![ProductID].Column(2)
End Sub
Private Sub ProductID_DblClick(Cancel As Integer)
On Error GoTo Err_ProductID_DblClick
Dim lngProductID As Long
If IsNull(Me![ProductID]) Then
Me![ProductID].Text = ""
Else
lngProductID = Me![ProductID]
Me![ProductID] = Null
End If
DoCmd.OpenForm "Products", , , , , acDialog, "GotoNew"
Me!ProductID.Requery
If lngProductID <> 0 Then Me![ProductID] = lngProductID
Exit_ProductID_DblClick:
Exit Sub
Err_ProductID_DblClick:
MsgBox Err.Description
Resume Exit_ProductID_DblClick
End Sub
I am not very good with codes. Thank you in advance.
My deadline is quickly approaching and I am LOST.