Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

two simple questions regarding access tables

can you purge an entire table in access with one command. and can you create a blank table either throught access or vba?
0
PawloA
Asked:
PawloA
  • 3
  • 2
3 Solutions
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>can you purge an entire table in access with one command
DELETE * FROM YourTable

>blank table either throught access or vba?
A quick way would be two queries...
SELECT TOP 1 INTO new_table FROM old_table
... then delete the one ...
DELETE * FROM new_table
0
 
jerryb30Commented:
select * into NewTable from oldTable where 1 = 2

Will create a copy of the old table, with no records
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
@jerry - Ha, I was looking for that trick but couldn't find it in time..
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
jerryb30Commented:
To create a table from scratch, see here: http://allenbrowne.com/func-DDL.html#CreateTableDDL
To get rid of a table:
Drop table tbaleName
0
 
Jeffrey CoachmanCommented:
Well you need to be a lot more specific.
To "Create" a table you need to define the fields, Indexes, Field properties ,...etc
Do you mean "Create a blank table form an existing table?
see the other experts posts...


But to be more correct, you can clear out a table (or run most All SQL queries) with this code:

    CurrentDB.Execute "DELETE * FROM YourTable",dbfailonerror
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Thanks for the split.  Good luck with your project.  -Jim
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now