dlookup help

D

deb

1) What am I doing wrong?

Want to display dupe msg if ([ContactSubID]= 48 and [Current] = Yes) or
[ContactSubID]= 49 and [Current] = Yes)

2) should this go in before update of ContactSubID and Current or the form?

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset '

Set rsc = Me.RecordsetClone

stLinkCriteria = "([ContactSubID]= 48 or [ContactSubID]= 49 and
[Current] = Yes)"
'Check table for duplicate ID
If DCount("ContactSubID", "t41ContactsProj ", stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Current Manager was previously entered." _
& vbCr & vbCr & "Verify and make changes(as needed).", _
vbInformation, "Duplicate Information"
End If
Set rsc = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top