473,403 Members | 2,183 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,403 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 1586
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.