I was wondering if anyone could point me in the right direction...I'm surprised I got this far by fumbling though...
I am trying to prevent users from entering a new record in the database if it already exists. I am looking at 2 particular fields - project and name.
If (Not IsNull(DLookup("Project", "qryExistingEntries", "Project = Forms![frmSummarizedActualRsrcData]!Project"))) Then
If (Not IsNull(DLookup("Name", "qryExistingEntries", "Name = Forms![frmSummarizedActualRsrcData]!Name"))) Then
MsgBox "An entry against this resource name and project already exists. Please update the existing entry.", vbCritical, "Warning!"
Me.Undo
End If
End If
It works...sort of. How can I associate both fields as one record rather than treating them independently? Right now, if there is any matching project and any matching name entry - it pops up the warning. I want to verify if one single record has a matching project and name. Do I have to concatenate the fields first then check them? There must be an easier way, don't ya think?
Anybody's input is greatly appreciated.
Thanks
I am trying to prevent users from entering a new record in the database if it already exists. I am looking at 2 particular fields - project and name.
If (Not IsNull(DLookup("Project", "qryExistingEntries", "Project = Forms![frmSummarizedActualRsrcData]!Project"))) Then
If (Not IsNull(DLookup("Name", "qryExistingEntries", "Name = Forms![frmSummarizedActualRsrcData]!Name"))) Then
MsgBox "An entry against this resource name and project already exists. Please update the existing entry.", vbCritical, "Warning!"
Me.Undo
End If
End If
It works...sort of. How can I associate both fields as one record rather than treating them independently? Right now, if there is any matching project and any matching name entry - it pops up the warning. I want to verify if one single record has a matching project and name. Do I have to concatenate the fields first then check them? There must be an easier way, don't ya think?
Anybody's input is greatly appreciated.
Thanks