Greetings all,
I have the code I use below but was now wondering if I can add another cirteria to base the dcount statement on. The code is in the beforeupdate() to allow me to avoid the duplicate.
What I would now like to add is that the Dcount is only calculated on say a particluar date, thus be a criteria in the table. ie I can have multiple locations but do not want to duplicate locations place on the same day.
Dim fBummer As Boolean
Dim iReply
Dim SID As String
Dim stLinkCriteria As String
SID = Me.Location.Value
stLinkCriteria = "[Location]=" & "'" & SID & "'"
If Len(Me.Location) > 3 Then
fBummer = (DCount("Location", "tbl_Data_Vessels", stLinkCriteria) <> 0)
If fBummer = True Then
iReply = MsgBox("The location " & SID & " has been used." & _
"Please enter the correct location", _
vbFatal + vbOKOnly, gstrAppTitle)
Cancel = True
End If
End If
thanks in advance
~rolf
I have the code I use below but was now wondering if I can add another cirteria to base the dcount statement on. The code is in the beforeupdate() to allow me to avoid the duplicate.
What I would now like to add is that the Dcount is only calculated on say a particluar date, thus be a criteria in the table. ie I can have multiple locations but do not want to duplicate locations place on the same day.
Dim fBummer As Boolean
Dim iReply
Dim SID As String
Dim stLinkCriteria As String
SID = Me.Location.Value
stLinkCriteria = "[Location]=" & "'" & SID & "'"
If Len(Me.Location) > 3 Then
fBummer = (DCount("Location", "tbl_Data_Vessels", stLinkCriteria) <> 0)
If fBummer = True Then
iReply = MsgBox("The location " & SID & " has been used." & _
"Please enter the correct location", _
vbFatal + vbOKOnly, gstrAppTitle)
Cancel = True
End If
End If
thanks in advance
~rolf