473,387 Members | 1,520 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,387 software developers and data experts.

How to store records into history table

i need help and its urgent...

i have created a table with fields: ItemNo, ItemName, IncomingStocks
and also DateReceived.

The IncomingStocks and DateReceived are volatile. it is expected to
change several times during the life of a record

I have tried the simple append query
but it keep on copying the whole records instead of the 'ONE' record
that i change..

What code do i need to use to have it append only the record the user
has
touched? I have created a append query, but this will append all the
records
from the main table to history table.

INSERT INTO ItemHistory ( ItemNo, ItemName, DateReceived,
IncomingStocks )
SELECT Item.ItemNo, Item.ItemName, Item.DateReceived,
Item.IncomingStocks
FROM Item;

can u guys please help me....

tx

Sep 22 '06 #1
6 7566
How about doing something really different and using a WHERE clause?
Urgent? Sounds like you urgently need to read the help file. And why
are you copying records around? Why not just stick a boolean field in
your table and set the records you want archived to Active=False or
something simple like that?

Try starting at the beginning. Create a query that selects the records
you want. Then change it into an update/append/delete query.

Sep 22 '06 #2

pi********@hotmail.com wrote:
How about doing something really different and using a WHERE clause?
Urgent? Sounds like you urgently need to read the help file. And why
are you copying records around? Why not just stick a boolean field in
your table and set the records you want archived to Active=False or
something simple like that?

Try starting at the beginning. Create a query that selects the records
you want. Then change it into an update/append/delete query.
Sep 22 '06 #3
how about just binding the data correctly?

Sep 22 '06 #4

but i need to store the exact same records..same field...for the
archive. for instance

DateReceived : 1-sep-2006
ItemNo : 1
ItemName : Sweets
IncomingStock : 50 boxes
and then the next day i bought another 10 boxes of sweets and i have to
fill in the form for 10

DateReceived : 2-sep-2006
ItemNo : 1
ItemName : Sweets
IncomingStock : 10

so in my archive i want it to be like this:

DateReceived ItemNo ItemName IncomingStock

1-sep-2006 1 Sweets 50

2-sep-2006 1 Sweets 10

and so on... however...when i'm using my append it become like this if
i have another item:

DateReceived ItemNo ItemName IncomingStock

1-sep-2006 1 Sweets 50

2-sep-2006 1 Sweets 10

1-sep-2006 1 Sweets 50

2-sep-2006 1 Sweets 10

3-sep-2006 2 Choco 15
Can sumone help me..i'm new in this area

Sep 22 '06 #5
I'm not sure why a single table won't do the job. if you change your
structure to this:
DateReceived : 1-sep-2006
ItemNo : 1
ItemName : Sweets
IncomingStock : 50 boxes
>>ArchiveDate: <Null>
then change the ArchiveDate when you want the record to "disappear".

UPDATE Inventory
SET ArchiveDate = Date
WHERE ArchiveDate IS NULL

The only practical difference is that instead of basing your queries
for current inventory or whatever on a _table_ you would base them on
the _query_ that showed the active records.
The nice thing about doing it this way is that if you want a full
history, you just query the entire table.

Sep 22 '06 #6
Why don't we back up a little? What are you trying to get OUT of this
data? What questions are you trying to answer? That's what would
dictate the structure of your database. If you don't know that,
there's absolutely no way to validate the structure of your database.

Sep 22 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tom Turner | last post by:
Here's the background on my situation. The question follows --- We have 600 units of mail going from our business to various Post Offices every morning. Every unit is accompanied by a paper...
2
by: Scott Baird | last post by:
HELP!!! I've got a DB with two tables (relationships with a autonumber). The database works just fine, but I've got a report I simply can't make work. I've made a query that uses data from...
1
by: KC | last post by:
I am using Access 2002, with a database template from MS Office. The Orders Management Database. I have tweaked this for use with our company. It is a small database with close to a 1000 records...
0
by: Harley | last post by:
I am trying to write a personal app to keep a bank balance and history. The problem I'm haveing is finding a decent way to store the data on a pocketpc under .net compact framewok useing vb.net....
5
by: eric.nguyen312 | last post by:
I have an amend button which when clicked puts the Job form into edit. When saved, Access backs up old job information into 'AmendedJobBackUp' table. What I want is to add a new column...
3
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we...
1
by: prairiewind via AccessMonster.com | last post by:
Throughout the year, I delete records which is a very common occurance in any database. However, from time to time, it would be nice to print off a list of the records that were deleted. Is it...
7
by: John Hopfield | last post by:
hi all, I have a table with lots of stock movements. ( stockmovements) Once per year the user need to run a routine that move these records into a table (history) and delete the movements from...
0
by: Emile van Sebille | last post by:
Laszlo Nagy wrote: Hmm... I wrote an browser based analysis tool and used the working name pyvot... I found Numeric to provide the best balance of memory footprint and speed. I also...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.