Solved

two simple questions regarding access tables

Posted on 2013-02-06
6
272 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

758 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

17 Experts available now in Live!

Get 1:1 Help Now