A
Amir
Hi!
I have a form of receipts with many fields:
ReceiptNumber, ProductKeyInReceipt etc.
When I am pressing the "New Record" button, I get the
following message: "The Microsoft Jet database engine
cannot find a record in the table 'tblProducts' with key matching
field(s) 'ProductKeyInReceipt'". What does that mean?
There is a subform in this form, which should show exctaly
what's the form's showing, but in continuous view.
Does that have any connection to the error message?
I have checked and the error is showing due to the
Msgbox Err.Description line, but I don't know why..
I would be thankful if you could help!
Here is the code:
Private Sub btnAddNewReceiptEvent_Click()
On Error GoTo Err_btnAddNewReceiptEvent_Click
DoCmd.GoToRecord , , acNewRec
'These lines are to synchronize the data in the form with the receipt
number data, which I save in ReceiptNumber textbox.
If Not IsNull(Me.OpenArgs) Then
Me!ReceiptNumber.SetFocus
Me!ReceiptNumber.Text = Me.OpenArgs
Me!ProjectName.SetFocus
Me.Requery
End If
'End of synchronization lines.
Exit_btnAddNewReceiptEvent_Click:
Exit Sub
Err_btnAddNewReceiptEvent_Click:
MsgBox Err.Description
'The error message appears here.
Resume Exit_btnAddNewReceiptEvent_Click
End Sub
I have a form of receipts with many fields:
ReceiptNumber, ProductKeyInReceipt etc.
When I am pressing the "New Record" button, I get the
following message: "The Microsoft Jet database engine
cannot find a record in the table 'tblProducts' with key matching
field(s) 'ProductKeyInReceipt'". What does that mean?
There is a subform in this form, which should show exctaly
what's the form's showing, but in continuous view.
Does that have any connection to the error message?
I have checked and the error is showing due to the
Msgbox Err.Description line, but I don't know why..
I would be thankful if you could help!
Here is the code:
Private Sub btnAddNewReceiptEvent_Click()
On Error GoTo Err_btnAddNewReceiptEvent_Click
DoCmd.GoToRecord , , acNewRec
'These lines are to synchronize the data in the form with the receipt
number data, which I save in ReceiptNumber textbox.
If Not IsNull(Me.OpenArgs) Then
Me!ReceiptNumber.SetFocus
Me!ReceiptNumber.Text = Me.OpenArgs
Me!ProjectName.SetFocus
Me.Requery
End If
'End of synchronization lines.
Exit_btnAddNewReceiptEvent_Click:
Exit Sub
Err_btnAddNewReceiptEvent_Click:
MsgBox Err.Description
'The error message appears here.
Resume Exit_btnAddNewReceiptEvent_Click
End Sub