Link to home
Start Free TrialLog in
Avatar of DeeDee Baldwin
DeeDee BaldwinFlag for United States of America

asked on

How to clear a back end table that is used as a form control source

I have a MS Access form that uses a table as the control source.  I would like to create a button so when the user click it ~ it will delete the contents of the table getting it ready for new entry.  I don't need to save the table contents.
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
<No Points wanted, just some extra info>
;-)

<I don't need to save the table contents. >
OK, but a user can always click the "Delete" button by mistake....
...Thus clearing the table before it should be cleared.
(note that in Access, once a record is deleted, it cannot simply be recovered with an UNDO...)

I always throw code like this around any "destructive" code

If msgbox("Clear all records?",vbyesno+vbquestion)=ybNo then
    exit sub
else
    'Your Delete code here
end if

;-)

JeffCoachman