Microsoft Access 2007 question

  • Thread starter Thread starter Shaun Culver
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around linking two tables in Microsoft Access 2007 to automatically transfer price data from a stock items table to a sales receipt table based on item types. The scope includes technical explanations of SQL commands and database functionalities.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant describes the need to link two tables where one contains item types and prices, while the other contains sales receipts with item types but no prices.
  • Another participant suggests looking up SQL commands, specifically the update and join commands, and mentions the Update Wizard as a potential solution.
  • A different participant clarifies that they are new to Access and SQL, expressing confusion about implementing SQL code and asking for a method similar to Excel's manual replication of data.
  • One participant provides a link to a solution they found, indicating they resolved their issue.
  • Another participant comments on the differences between spreadsheet and database implementations, suggesting that there are automated methods in Excel and emphasizes the importance of understanding SQL commands.
  • A participant offers an example SQL command for updating the price in the receipt table based on the stock table, while also noting potential issues with Access syntax.
  • There is a cautionary note that replicating the price field may not be advisable and that joining tables can be done whenever associated data is needed.

Areas of Agreement / Disagreement

Participants express differing levels of familiarity with Access and SQL, leading to a mix of suggestions and clarifications. There is no consensus on the best approach, and some participants caution against certain methods while others provide solutions.

Contextual Notes

Some participants mention the need for an effective date in the stock table, and there is uncertainty regarding the correctness of the provided SQL syntax for Access.

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.
 

Similar threads

  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 27 ·
Replies
27
Views
4K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K