473,402 Members | 2,053 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,402 software developers and data experts.

Copy record to a different table in Access 2007

I would like to be able to copy the current record to a different table. I am tracking donations and I create a new table of donations each year--some of the records will be the same or slightly different. I used to do this with a macro in Access 2003, but it doesn't work in Access 2007 the way it was, and I can't find other commands that will work. I would appreciate any help.
Apr 13 '10 #1
12 6557
Why not just store all data for all years in one table. Have a field for year, and then run a query that selects only for the year you want to see. This saves duplicating work and would use the database to its best potential.
Apr 13 '10 #2
patjones
931 Expert 512MB
Hi Cindy,

errol999 is correct here. It violates accepted database design rules to have multiple tables that store the same information. If your goal is to run reports off your data, you would simply create a query that picks out the year you want information for, and then base your report on that query.

Pat
Apr 13 '10 #3
NeoPa
32,556 Expert Mod 16PB
Cindy,

While I also echo what the others have said (See Normalisation and Table structures for further info), I wonder if your question relates simply to moving data from one table to another simply due to its year.

If not, perhaps you could explain a little more clearly and we may be able to be of some assistance.
Apr 13 '10 #4
This database is for a charity and is used for about 3 months of each year. We have two tables, one is called donor possibilities, and the other is auction items. At the beginning of each year we make a backup copy of the table and call it by the year (as we infrequently need to look back at previous years donations, but we do sometimes), and then move the records from auction items table, leaving it empty, and append them to the donor possibilities table. The two tables have many of the same fields, but some are different. The donor possibilities table always has some records left in it, either from businesses that donated in the past but not the previous year, or are perhaps new businesses that didn’t exist the previous year. We run a report on the donor possibilities table based upon the volunteer that is to contact them. In this report, I want the business to be listed only once, and only with what they gave the previous year, not everything they have given in years past. I can’t select the records by year as some may have not donated the previous year, but had asked to be contacted again, or some may not have been in business last year. I really don’t want to have to have a field that I have to keep updated to mark them as active. As businesses go out of business or ask to not be contacted again, there is no reason for us to keep the record. If they do donate something, that record is moved to the auction items table and the additional fields are updated. It is nice to just be able to create a button on the form to click to make this happen.
Apr 16 '10 #5
@NeoPa
Please see my post. I am having trouble figuring out if I need to reply by clicking the reply after the person's comment, or to click post reply. It seems like either my post is not saved, or the person is never notified of my most recent post. Please excuse my difficulties in posting correctly.
Apr 16 '10 #6
NeoPa
32,556 Expert Mod 16PB
No worries Cindy. They are all possible ways of replying. Reply by a post takes you to a quick-reply area on the same page (but also saves which post you clicked in order to quote it) where you have another option to go to the Advanced reply page, and Post Reply takes you to the Advanced reply page directly.

Why do you think the person may not be notified of the post though? Or that the post may not have been saved?
Apr 19 '10 #7
Thanks for your reply. I think it because after I spent several minutes typing the reply, it never showed up in the thread, and no one ever repsonded. I'm not sure what's going on. When I click reply, it takes me to a page that says to sign up, or login in if you are already a member. When I login at the current member part, it then says "we show you are already a member" and then it never takes me to where I can reply. So then I start over, then finally it lets me reply.

It's been long enough that for this year I've finished copying all my records manually, but I'd still like to be able to do this for next year, assuming I'm still the one working on the database.
Apr 19 '10 #8
NeoPa
32,556 Expert Mod 16PB
I need to revisit this. I haven't had much time to look at any complicated threads recently so I've had to leave this aside until I get a bit more than a minute to sit down and check properly.
Apr 20 '10 #9
NeoPa
32,556 Expert Mod 16PB
There is much that can be done in a situation like yours Cindy, but to point you in the right direction I'd need to understand you a little better. I've read through your post #5 and I can understand you have two tables [Donor Possibilities] & [Auction Items]. What I don't understand is how these tables can contain similar data. Without further explanation I can only go by the names. It would seem clear that [Donor Possibilities] contains data on individuals or enterprises that may have, or may be constrained to, donate in some way. [Auction Items] on the other hand, would appear to be a table to maintain those items that could be auctioned to raise funds. I see no possibility of overlap here (short of auctioning a meal with some of the more attractive donors to raise funds - but I somehow doubt you're talking about that). You say the two tables have many of the same fields.

As far as archiving the data goes, this is relatively straightforward, but does depend absolutely on knowing precisely what you want archived. It's no good having a general understanding of what needs doing that a human may understand. It must be based on solid and explained logic. If you have this logic then it needs to be explained clearly and precisely. Precisely enough that any two people reading the logic would always be in a position to determine what needed archiving in all possible circumstances.

This logic is normally expressed as criteria relative to the fields contained within the specific table. I could guess that the table to be archived is [Donor Possibilities], but that would need to be clarified and some fields (particularly the relevant ones at least) would need to be shared with us before we could even start to think about going forward.
Apr 20 '10 #10
My apologies in advance for this being so lengthy, but when I tried to be brief, apparently the information was not sufficient to explain why I wanted to be able to move a record from one table to another.

Each year we have a fundraiser and we collect items from local businesses to place in a silent auction. We have many businesses that donate something year after year. Sometimes they donate the same thing (like a gift certificate) and sometimes they may donate something different (like a lamp one year, and a picture the next). Some of these businesses decide they can’t donate this year, but asked to be contacted in the future, and some go out of businesses. Sometimes there are new businesses that we want to ask to donate.

We start off with a table (donor possibilities) that has some general info like the business name, address, phone number, contact person and a place for notes, like when we called, what they said, did they need a request on letterhead, when we are to pick it up or if they are going to mail it, etc. All things that pertain only to acquiring the donation but have little significance after we actually get an item donated. We then assign a volunteer to contact each business. Some donate, some don’t. If they do donate, then we want to move the record into the auction items table, and add (or update) some other info, like the value and description of the item (which may or may not change), but leaving off the notes in the memo field about the steps that led up to getting the donation. This auction items table also has a place for an item number that we assign to track the item, whether the item will be in the live or silent auction, the winning bid amount and winning bid number. After the auction is over we enter the winning bidder numbers and amounts and then print receipts as well as event reports.

The next year we then have both tables. The records still in the donor possibilities tables are only those that didn’t donate but asked to be contacted in the future or are new businesses that we added as we got ready to start the process all over. I select all the records from the auction items database and move them back to the donor possibilities table, minus the fields that pertain only to the auction, like item number, live or silent auction, etc. Now the auction items table is empty and the donor possibilities table has everyone that donated last year, plus new businesses, plus any that didn’t donate last year but asked to be contacted in the future. We then print the list, assign the businesses to volunteers, and delete any that anyone notices that has gone out of business. I print a list for each person of their possibilities so that the volunteer can tell the business what they donated the last year if they ask, and we start the whole process over again.

I have several reasons that I don’t want to try to use one single table for this. I don’t want to add a year field and select from that, as some donate each year, some don’t, and some are new. I don’t want to have to add a field that says if they are active or not as it would have to be manually updated each year in order to be of use. I don’t want to have to list all the records from over several years, as most people don’t care what they gave 2 or 3 years ago, some businesses are no longer in businesses and it would just make a much longer and less manageable list. Since some fields are only relevant during the time we are seeking the donation ( like the notes memo field where we note to ourselves when we called, what they said, did they need something in writing) and some are only relevant during and after the auction (whether we assigned it to the live or silent auction, the item number, the amount the item is valued at, the winning bidder number and bid amount) I really don’t want to use only one table.

But—if I can find the record in the donor possibilities table, select the fields for donor name, address, city, state, zip, contact, phone, item, and volunteer then move that into to a new records in the auction items table (where I fill in updated item info, then later winning bidder numbers and amounts) and deleting the record in donor possibilities by just clicking a button on the form, it would make things much easier and faster for me than selecting the entire records, cutting it, replying yes to the info about losing the record in the donor possibilities table, closing the form, opening a different form, selecting an empty records, pasting, and then answering yes that it’s OK that not all field match to just paste the ones that do.

Again, my apologies for the length—but I’ve tried twice to get an answer for this with brief descriptions to no avail, and it’s now too late to help me this year, but if I can still get an answer it will help me next year. My most gracious thanks to anyone that helps. I know enough to know the kinds of things code and Access can do, but have little opportunity to actually learn how to make these things happen. It's so helpful to be able to ask others.
Apr 20 '10 #11
NeoPa
32,556 Expert Mod 16PB
I will look at this when I have a little more time. I appreciate that many people find expressing the pertinent details succinctly and unambiguously very hard, so this explanation will be fine. Clearly you've gone to a great effort to be as clear as you can be, so I'm happy to read through it to understand as well as I can. It may take a while to have the time though. Probably later today, but I will certainly look sometime soon. From there I hope to be able to guide you to a solution that you're comfortable with.
Apr 21 '10 #12
NeoPa
32,556 Expert Mod 16PB
Right. As we are now talking of moving data both ways, but at the same time losing certain fields as they may be relevant for one but not the other, let me first start by suggesting you consider the possibility of adding certain fields to the table they are not relevant to, simply to facilitate moving them back later, in preparation for the next year. These fields needn't be included on the form that you use to display or edit these records, but thay can be kept in the background in reserve for when they next may be copied across. This is not necessary for your main process to work, but I think it may prove worth considering to make the job a little easier. You'd need to decide which fields would be useful to have the following year.

On to the main process. SQL can be used to move the data, or Recordset processing can be. SQL is often used for handling multiple records at once, which it does well, but can be used for a single record too. Moving data (as opposed to copying it) is done in a database as a two-stage process.
  1. Create a new record in the Destination table with the details taken from the Source.
  2. Delete the record from the Source table.
To do this of course, you'd need to specify each field to be copied across. In SQL you can specify a * to mean all fields, but that will only work if the fields are the same in both tables. IE. Not something we can use in this case.

SQL commands stored in a string can be executed in sequence behind the Command Button, so the whole moving process can be executed seamlessly once the Command Button is clicked.

Does this sound like the sort of thing you're after? If so, then please refer back to post #10 where I suggested some things we'd need before we could progress. Details of how your data is structured are indispensable at this stage. We cannot proceed meaningfully without this information.
Apr 21 '10 #13

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

Similar topics

19
by: davidgordon | last post by:
Hi, I need some pointers/help on how to do the following if it possible: In my access db, I have the following: Tables: Products, Sub-Assembly, Product-Pack Table, Products
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
1
by: Maximus | last post by:
I have an issue and I am not sure what the best resolution would be. Currently I have an .asp page that looks for a record in an Access table (tbl_WJS_Input) where the week ending date is...
2
by: Maximus | last post by:
I need some help. I have an .asp page that interfaces with an Access table (wjs_SuperInput). The .asp page looks to the table and pulls a recordset based on a job number, 12345, and a weekending...
4
by: mcca0081 | last post by:
hi - i'm trying to delete one of the duplicate records based on the most current date. here's the code for my access 2000 db. any help would be appreciated!!! - thank you kindly Sub...
0
by: Cindy Huyser | last post by:
I have an Access 2000 database behind a threaded Java application that that can have have concurrent access to the same table (but not the same record). The database is set up for shared access...
2
by: mark_aok | last post by:
Hi all, I'm typing up a report for a database, and in this massive design manual that I'm writing, I'd like to indicate the number of bytes of a typical record in each table. And I was...
20
by: dav3 | last post by:
Alright folks I am in need of a lil guidance/assistance here. I have a program which reads in a txt file. This txt file contains lines of the form January 3, 2007, 85.8 Now each line of the txt...
3
by: Gord | last post by:
If I have a form open with a subform control on it in datasheet view that has its record source set to a query or a table, is it possible to determine which record the user has clicked into with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.