In my form...
This is associated with the button that calls the getfilename sub.
The below code is suppose to check 3 fields to see if it is a duplicate record. If it is a duplicate then bring up the msgbox to click OK to go back to the record and make changes or Cancel to delete the record. If the record is not a duplicate then it should move on to the getfilename.
The first If statement works great but when combined with the msgbox stmt, it thinks all records are duplicates.
If DCount("*", "tSchedImages", "[ProjID] = " & Me![ProjID]) > 0 And DCount("*", "tSchedImages", "[Page] = " & Me![Page]) And DCount("*", "tSchedImages", "[ReportDtID] = " & Me![ReportDtID]) <> 1 Then
blnOK = Confirm("This schedule is a duplicate. Click 'Ok' to change input, or 'Cancel' to delete record.")
Cancel = True
If Not blnOK Then
'set all required fields so record can be deleted.
Me![Photo] = "none"
Me![ReportDtID] = 1
Me![Page] = 999999999
Me.Undo
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
Else
'Use the Office File Open dialog to get a file name to use
' as a picture.
getFileName
End If
Please help!!
This is associated with the button that calls the getfilename sub.
The below code is suppose to check 3 fields to see if it is a duplicate record. If it is a duplicate then bring up the msgbox to click OK to go back to the record and make changes or Cancel to delete the record. If the record is not a duplicate then it should move on to the getfilename.
The first If statement works great but when combined with the msgbox stmt, it thinks all records are duplicates.
If DCount("*", "tSchedImages", "[ProjID] = " & Me![ProjID]) > 0 And DCount("*", "tSchedImages", "[Page] = " & Me![Page]) And DCount("*", "tSchedImages", "[ReportDtID] = " & Me![ReportDtID]) <> 1 Then
blnOK = Confirm("This schedule is a duplicate. Click 'Ok' to change input, or 'Cancel' to delete record.")
Cancel = True
If Not blnOK Then
'set all required fields so record can be deleted.
Me![Photo] = "none"
Me![ReportDtID] = 1
Me![Page] = 999999999
Me.Undo
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
Else
'Use the Office File Open dialog to get a file name to use
' as a picture.
getFileName
End If
Please help!!