R
Ryan
I have a form that the after update makes sure not to duplicate the
FileName field. For some reason I can not figure out how to open a different
form if there is a duplicate. I know I need to change this part of the code,
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
but I'm not sure what to change it to. The form I want to open if there is
a duplicate entry is called "ERABatchFilesViewForm", and I need it to open
with the same stLinkCriteria ([FileName]) as the code below shows.
Private Sub FileName_AfterUpdate()
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.FileName.Value
stLinkCriteria = "[FileName]=" & "'" & SID & "'"
If DCount("FileName", "EraBatchFiles", stLinkCriteria) > 0 Then
Me.Undo
MsgBox " WARNING! File Number " _
& SID & " already exists." _
& vbCr & vbCr & "You will now been taken to that record. Make sure
that the file is not a duplicate by checking the file size.", vbInformation _
, "Duplicate Information"
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub
FileName field. For some reason I can not figure out how to open a different
form if there is a duplicate. I know I need to change this part of the code,
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
but I'm not sure what to change it to. The form I want to open if there is
a duplicate entry is called "ERABatchFilesViewForm", and I need it to open
with the same stLinkCriteria ([FileName]) as the code below shows.
Private Sub FileName_AfterUpdate()
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.FileName.Value
stLinkCriteria = "[FileName]=" & "'" & SID & "'"
If DCount("FileName", "EraBatchFiles", stLinkCriteria) > 0 Then
Me.Undo
MsgBox " WARNING! File Number " _
& SID & " already exists." _
& vbCr & vbCr & "You will now been taken to that record. Make sure
that the file is not a duplicate by checking the file size.", vbInformation _
, "Duplicate Information"
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing
End Sub