Microsoft Access 2007 question

  • Thread starter Thread starter Shaun Culver
  • Start date Start date
AI Thread Summary
To link two tables in Microsoft Access 2007, one must use SQL commands to transfer prices from a stock table to a sales receipt table based on matching item types. The Update Wizard can facilitate this process, allowing users to create an update query that joins the two tables. While Excel offers manual methods for data entry replication, Access requires an understanding of SQL syntax for effective data management. The suggested SQL command for this operation is "Update receipt Set receipt.price = stock.price From receipt Join stock On receipt.item_type = stock.item_type;". It's important to note that while this method can work, maintaining a normalized database structure is advisable to avoid redundancy.
Shaun Culver
Messages
69
Reaction score
0
I have two tables that I would like to link in a specific way. Both tables have a field name labelled, for example, "Price". Both also have a field name labelled, for example, "Item type".

In the first table, each of my stock items are listed in the "Item type" field, with the corresponding price in the "Price" field.

Now the problem...

In the second table, I have many sales receipt entries, with the item types entered (sorted by date), but no entries in the price field.

How do I automatically transfer the price to the second table based on what is entered in the first table?
 
Technology news on Phys.org
Sounds like homework to me.
Try looking up the update and join SQL commands.
Post your attempt at the SQL for this it you still have problems, although the Update Wizard will probably do it for you.

Note: Replicating the price field probably isn't a real good idea and your stock table should have an effective date in it.
 
Nope, not homework.

I am new to Access and databases, so I do not understand how to implement SQL code. Are you referring to this:
http://www.sqlcommands.net/sql+update/

What is the "update wizard"?

Excel allows a "by hand" method for this. By typing a, for example, "Price" in block A1, and then dragging the bottom left square icon down, you may replicate the same entry n number of times. Is there something similar in Access? By filtering the records according to "Item", the same price can be applied to all records.
 
While some concepts are shared between spreadsheets and database the implementation and terms used are different.
Even in Excel you don't have to do that by hand.
Multiple sheets and a macro will do it for you.

In general you need to know what the commands in the link you posted do.
The wizard is query tab -> new -> update.

For filtering in the case you mention you would join the two tables on item_type.
The command Update ... Set can the replicate the fields.

There are several ways of writing this in SQl, here is one approach

Update receipt
Set receipt.price = stock.price
From receipt
Join stock On receipt.item_type = stock.item_type;

This may not be entirely correct since access tends to be bracket happy.

You probably don't want to do this though.
You can join the tables anytime you want the associated data.

Edit: should have looked at the post again, I got called away for a while.
Good luck.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
10
Views
2K
Replies
27
Views
3K
Replies
12
Views
4K
Replies
0
Views
2K
Replies
1
Views
1K
Replies
1
Views
3K
Replies
8
Views
2K
Back
Top