II use a FileDialog to browse to a file and insert it into a control. If I was to click the command button and let the FileDialog open and then click cancel this makes my record Null and Dirty. If I was then to click outside of that control into another control Access gives the PopUp Message Error Cause Duplicate entrys in table ProductImages. I have a Unique Index on the field ProductImageLocalPath.
I have tried several different events with no success.
Here is the code below I last used.
Private Sub ProductImageLocalPath_LostFocus()
If IsNull(Me.ProductImageLocalPath) Then
If Me.Dirty Then
CurrentDb.Execute ("Delete * from ProductImages Where [ProductImageID]=" & Me.ProductImageID)