Solved

two simple questions regarding access tables

Posted on 2013-02-06
6
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 66

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 66

Expert Comment

by:Jim Horn
ID: 38861695
@jerry - Ha, I was looking for that trick but couldn't find it in time..
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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 66

Expert Comment

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

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

623 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