Pdeters
asked on
Access 2003 duplicate record in subform want to autodelete and let user know
I have a subform on a form. There are two fields that show on the form.
The first field is a Main Account number and what this "Main" account number listed only once. If the user types in this main account number again on the subform i want a pop up to tell them this is a duplicate and delete it.
The first field is a Main Account number and what this "Main" account number listed only once. If the user types in this main account number again on the subform i want a pop up to tell them this is a duplicate and delete it.
try this in the beforeupdate event of the control for main account (txtAccount in this code)
private sub txtaccount_beforeUpdate(ca ncel as integer)
if dcount("*","tablesubform", "accountnu mber=" & me.txtaccount)>0 then
msgbox "duplicate account"
cancel=true
end if
end sub
private sub txtaccount_beforeUpdate(ca
if dcount("*","tablesubform",
msgbox "duplicate account"
cancel=true
end if
end sub
ASKER
Is there a way to not save the record and jump back to the previous record in the subform?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER