Solved

two simple questions regarding access tables

Posted on 2013-02-06
6
291 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Back Up Your Microsoft Windows Server®

Back up 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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vba sql wild card passing in code 3 24
Can not open the Access Help ? 3 54
A Function to parse a text string 4 36
Calculate Time acces 2010 12 29
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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 …

777 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