Solved

two simple questions regarding access tables

Posted on 2013-02-06
6
284 Views
Last Modified: 2013-02-07
can you purge an entire table in access with one command. and can you create a blank table either throught access or vba?
0
Comment
Question by:PawloA
  • 3
  • 2
6 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 167 total points
ID: 38861667
>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
 
LVL 26

Assisted Solution

by:jerryb30
jerryb30 earned 333 total points
ID: 38861674
select * into NewTable from oldTable where 1 = 2

Will create a copy of the old table, with no records
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 38861695
@jerry - Ha, I was looking for that trick but couldn't find it in time..
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 26

Assisted Solution

by:jerryb30
jerryb30 earned 333 total points
ID: 38861767
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38861829
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
 
LVL 65

Expert Comment

by:Jim Horn
ID: 38864157
Thanks for the split.  Good luck with your project.  -Jim
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now