感謝您的回覆!
我想通了VBA代碼應該如何,對於同樣的問題,任何人檢查出來:
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.BloedeenheidID.Value
stLinkCriteria = "[BloedeenheidID]=" & "'" & SID & "'"
'Check ScannedForms table for duplicate BloedeenheidID number
If DCount("BloedeenheidID", "ScannedForms", _
stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning! The ID number " _
& SID & " has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", _
vbInformation, "Duplicate Information"
'Go to record of original BloedeenheidID
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub
退房使用DLookup – Fionnuala
你可以發佈你的更新前代碼片段? –