473,326 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

writing code for an append to destroy table

Hi,
I know I have to create the Append Table first and then the Append query which I know how to do in Access 2010.

I have several thousands of records that are in the process of being destroyed. Their status will change form A to D and I would prefer to keep them in a separate table.

What is the easiest way to write the necessary code so that these destroyed records automatically transfer over to the new table? Do I also need to use a filter? I never took a course in Access so I mostly learn as I go along. Any assistance you could give me will be appreciated.

Thanks,
Michael Kirkby
Aug 25 '14 #1
11 1585
twinnyfo
3,653 Expert Mod 2GB
Michael,

Please provide a little more information on your question. Typically, we don't "destroy" tables in Access. We can delete records, and it is also possible to delete an entire Table, but I'm not exactly sure what it is that you want to do.

Do you simply want to identify a certain set of records (defined above as previously being "A", but now they are "D"), and then copy those records to a different table, and then delete those records from their original table?

Also, how are you planning to do this? Have you designed a form that will make these updates? What have you tried so far?

I know you say you are a novice, and that's not a problem--we've all been there. However, some additional information would help us help you better.
Aug 25 '14 #2
Each record or entry has a Status field. When we destroy the actual file or box in storage then the record's status on the database changes from A for active to D destroyed.
What I want to do is to create a table for all files marked as D to be automatically appended to this Destroyed table.
I've written a string for queries regarding file type and location but I'm just not sure how to write this one. Any suggestions?
Aug 25 '14 #3
twinnyfo
3,653 Expert Mod 2GB
A simple way to do this (if you want to maintain the same field structure as the original table is to first, make a copy of the Table that has the original records. (If the table is a linked table, you must go to the Back end DB.) Simply select the Table, Ctrl-C, Ctrl-V. Access will ask if you want the Straucturea nd Data or Structure Only. Choose Structure Only.

Then, create a query that selects all the fields in these records, in which your only criteria should be "[FileStatus] = 'D'". In the Query Design Tab, select "Append Query". It will ask which Table to append to and select the new table you just made.

Save that query (it shoudl work that simply).

To get rid of those records from the original Table, create another query with the same criteria, but make it a "Delete Query". These two queries, when run sequentially should copy all the records with File Status "D" into the new archive table and then delete those records.

Hope this helps.
Aug 25 '14 #4
Rabbit
12,516 Expert Mod 8TB
You shouldn't have 2 tables to separate these records. You can leave them in one table and use the status to filter as appropriate.
Aug 25 '14 #5
twinnyfo
3,653 Expert Mod 2GB
Rabbit,

True that--however, I have a bunch of records that I must retain, but very seldom use. I can either save them in an archive table (based on the status of the record) or keep them in the same table and filter as needed.

However, wouldn't this significantly slow down the performance of the DB as the table grew much larger over time? This keep smy table down to around 3-4,000 records, instead of 25-30,000 records (and growing).

Is there a way to do as you suggest without hindering performance?
Aug 25 '14 #6
Rabbit
12,516 Expert Mod 8TB
An index helps a lot. But I usually use SQL Server as a back end.
Aug 25 '14 #7
zmbd
5,501 Expert Mod 4TB
Just to see how long this would take
I pulled a linked table from our SQL back end into access.
20 fields of various datatypes
6 of the fields are FK
45000 records.
Initial pull from backend to local took 3 seconds.
The Initial unfiltered query, using wizard for simple select query, returning all fields took less than 2 seconds.
Closing the database and reopening (I didn't want any residual mumbo-jumbo) Pulled up the simple select and filtered on one of the fields... took under 2 seconds.
Ran one of my more complex queries on this local data (usually ran over the link to the SQL-Sever)
Over the network this query takes 5 seconds to run; however, I'm also using the entire SQL backend not just a subset, took about 3 seconds to run on the 45000

So, not a rigorous testing; however, in a properly normalized database, things don't seem to run too badly.
Aug 25 '14 #8
NeoPa
32,556 Expert Mod 16PB
@Twinnyfo.

You should be very careful before you ever diverge from normalisation concepts on the basis of performance. As a general rule the impact is much less than expected when properly designed. As a reliable concept you will introduce complications into your system that normalisation and proper database design are designed to protect you from.

Much of my work ATM is related to fixing a system where the idea of archiving little-used data was allowed to take precedence. To be fair, the designer knew no better at that point in time. It's very slow and painful work when there are much better enhancements cried out for.
Aug 25 '14 #9
twinnyfo
3,653 Expert Mod 2GB
@ NeoPa, Z and Rabbit,

Some good things for me to think about. Just as a thought, is it worth "reimporting" the old data? I know this might take a while to get it right--but also, I am concerned about proper design. That's why I am on this site, right?

;-)
Aug 26 '14 #10
NeoPa
32,556 Expert Mod 16PB
First make sure you have the design of your live table right - which includes the indices you'll need - then yes. Transfer the archived data back to the main table.

Also, ensure all objects (Queries, forms, reports etc) know that if they want live data only they need to filter on the [Status} (or whatever) field.
Aug 27 '14 #11
twinnyfo
3,653 Expert Mod 2GB
@NeoPa - I will start a new thread on this....
Aug 28 '14 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jagdip Singh Ajimal | last post by:
I have two tables, appointments and backupappointments. I also have a function getAppointments(theDate DATE) RETURN RECORDSET (which has not been written yet). What I want the function to do is...
3
by: casey a | last post by:
Hi all, I would like to take the function below and write the user name to a field on a form and store it in the corresponding table but I'm not sure how to get to where I'm at to where I need to...
1
by: Pete Smith | last post by:
I am making the animated text inside the table cell data. The animation is done using Javascript. Here is the code looks like.. <table><tr><td><script>Java Script code which does animation of...
3
by: Darin | last post by:
This is something that on the surface seems like it should be simple, but I can't think of a way to do this. I have a table that is a list of "jobs", which users create and use. It has a single...
2
by: sj | last post by:
Situation: I have 2 tables, parent table (Invoice) and child table (InvoiceDetails) that is link by InvID in the child. Requirement: Need to do one-time append of information to another table...
2
by: Vasu | last post by:
Hi! Could anybody help me guide how to write something in between <td></ tdtags. When I try to write through document.write, it wipes the whole table and writes on to a blank document, but when...
10
by: hedges98 | last post by:
Hello After spending my morning search for a solution to what I need to do, I am a little stuck on which direction to take. Here is the scenario - I have a database that contains information...
1
by: Katie Howard | last post by:
Hi, I’m just starting a database that will contain historical data of all the conferences that our employees have attended over the years. I have 3 tables (Employees, Conferences, and the 3rd is...
2
by: Jeffrey Tan | last post by:
I am trying to insert a record into a table and when i try to do so im getting an append error: 'Database' set 0 field(s) to Null due to a type conversion failure, and it didn't add 1 record(s) to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.