Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete All Records

Status
Not open for further replies.
Sep 27, 2002
14
0
0
US
Is there a way in Access 2000 to delete all the records in a table but leave the structure? I need to have a lady click on a button that will delete all the current records and then click on another button that will import all the new months data in Ascii delimited.

thanks for any help
 
if you create a query or call it from code the following syntax applies

DELETE * from table "What a wonderfull world" - Louis armstrong
 
in a command button on click event
docmd.runsql "delete * from tablename"
DoCmd.TransferText acImportDelim, "specname", "tablename", "filename", hasfieldnames
 
Sure.. piece of cake.
First, create a macro that will delete all the records in the table. The macro's Action will be to RunSQL. It's SQL statement will look something like:
"Delete * From yourtable;"

Next, on your form, create a command button that runs the macro.

Job done.
 
well three for the same price, must be the sale period "What a wonderfull world" - Louis armstrong
 
I tried:

DoCmd.RunSQL "delete * from ZPAY6176"
DoCmd.TransferText acImportDelim, , "ZPAY6176", "H:\Access\New Carpool\z_pay617.lis", False


Which deletes all the records but then I get a:

"Cannot Update. Database or Object is Read Only"

Is that because the table ZPAY6176 is still being used by me? Do I need to release it somehow? If so, how? If not, how do I get around this? I checked and the database is not read only.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top