Groundrush
Registered User.
- Local time
- Today, 21:49
- Joined
- Apr 14, 2002
- Messages
- 1,376
Please can anyone tell me where I’m going wrong
I don’t have much experience in VBA so please be gentle.
I have table called “Concept Orders”which stores all our orders for jobs to be carried out and
I have a form in which users type in details of the work.
A combo box is used to select a “JobNo”, (which is limited to list) from the Concept Orders Table
Those records are then stored in a table called “Sub-Contractor Orders”.
The JobNo is indexed to (duplicates ok.) which is fine because we may on occasion use the same job for more than one Sub-Contractor.
The problem is, that users are duplicating orders without knowing about it.
I am trying to notify them with a message warning them that they duplicating an order,
They then have a choice to continue or first check
This is the code that I am using on the “JobNo” control of the form.
Private Sub JobNo_AfterUpdate()
If DCount("[JobNo]", "Sub-Contractor Orders", "[JobNo]=Forms![frmSub-Contractor Orders]![JobNo]") > 0 Then
MsgBox "This Job No has already been issued.", 48, ""
End If
End Sub
This code allows me to enter the first record, after that the message is triggered every time a new record is created.
Where am I going wrong?
I know this will probably be an easy one for you guys
Any help will be much appreciated.
thanks

I don’t have much experience in VBA so please be gentle.
I have table called “Concept Orders”which stores all our orders for jobs to be carried out and
I have a form in which users type in details of the work.
A combo box is used to select a “JobNo”, (which is limited to list) from the Concept Orders Table
Those records are then stored in a table called “Sub-Contractor Orders”.
The JobNo is indexed to (duplicates ok.) which is fine because we may on occasion use the same job for more than one Sub-Contractor.
The problem is, that users are duplicating orders without knowing about it.
I am trying to notify them with a message warning them that they duplicating an order,
They then have a choice to continue or first check
This is the code that I am using on the “JobNo” control of the form.
Private Sub JobNo_AfterUpdate()
If DCount("[JobNo]", "Sub-Contractor Orders", "[JobNo]=Forms![frmSub-Contractor Orders]![JobNo]") > 0 Then
MsgBox "This Job No has already been issued.", 48, ""
End If
End Sub
This code allows me to enter the first record, after that the message is triggered every time a new record is created.
Where am I going wrong?
I know this will probably be an easy one for you guys
Any help will be much appreciated.
thanks