I've searched the threads and have come up with good advice but I'm having trouble implementing the solution. Any help you can provide is most appreciated.
I have a form, frmPROPERTY, with a field, PROP_ID, from the table tblPROPERTY. I need to display a message whenever someone enters a PROP_ID that is already in a previous record. It's ok to have a duplicate but I want the user to know that it is one. I found the following script and tried it in After Update but nothing seems to be happening when I enter two of the same Ids.
Private Sub PROP_ID_AfterUpdate()
If DCount("*", "tblPROPERTY", "[PROP_ID]=" & Me.PROP_ID) > 0 Then
MsgBox "This property has apparently been involved in a previous project"
Me.PROP_ID = Null
End If
End Sub
I may be missing something very obvious. PROP_ID is a text field with IDs such as 000-0000 or 000-0000-0000 and no validation rules applied. There are also null values for this field in the table.
Thanks for your help.
I'm also interested in general naming convention for objects and fields if you have an extra second. Thanks.
Trent Park
I have a form, frmPROPERTY, with a field, PROP_ID, from the table tblPROPERTY. I need to display a message whenever someone enters a PROP_ID that is already in a previous record. It's ok to have a duplicate but I want the user to know that it is one. I found the following script and tried it in After Update but nothing seems to be happening when I enter two of the same Ids.
Private Sub PROP_ID_AfterUpdate()
If DCount("*", "tblPROPERTY", "[PROP_ID]=" & Me.PROP_ID) > 0 Then
MsgBox "This property has apparently been involved in a previous project"
Me.PROP_ID = Null
End If
End Sub
I may be missing something very obvious. PROP_ID is a text field with IDs such as 000-0000 or 000-0000-0000 and no validation rules applied. There are also null values for this field in the table.
Thanks for your help.
I'm also interested in general naming convention for objects and fields if you have an extra second. Thanks.
Trent Park