I have two Access 2003 tables, one has a "Zone" and "Lot1SqFt" that
changes with each record. (8,000+ records)
A portion of this table:
CustomerID ZONE Lot1SqFt SqFtPrice TotalPrice
21 2 27100 $1,599.00
$1,979.00
37 4 15475 $1,068.00
$1,392.00
366 1 17190 $1,187.00
$1,292.00
The other table has fields (columns) for each "Zone" plus a Minimum
and Maximum field and "Records" (rows) that denote the size
"Lot1SqFt". (14 fields and 8 records)
A portion of this table:
SqFtMin SqFtMax 0 1 2
3 4
4001 6000 $0.101 $0.112 $0.123 $0.127 $0.130
6001 7000 $0.099 $0.102 $0.116 $0.121 $0.125
7001 20000 $0.097 $0.107 $0.097 $0.087 $0.097
20001 50000 $0.090 $0.099 $0.096 $0.076 $0.086
I need to have Access find the right value, in the 2nd table, for the
two values from the 1st table and use that value to determine the
TotalPrice (as we move through the records)
Examples: (Maybe not needed)
Zone 2 with a Lot1SqFt of 27100 has a value of $0.096 which gives
a TotalPrice of $2,601.60
Zone 4: Lot1SqFt of 15475 with a value of .097 = $1,501.08
Zone 1 is 17190 and .099 gives $1,701.81
This is straight-forward to the human mind - - - but my mind doesn't
know how to have Access do this! Can anyone help me with this? 2 1479
On 29 May 2007 18:08:42 -0700, Deac <mw*****@kconli ne.comwrote:
You make it MUCH simpler if you first redesign the second table. It
should only have these fields:
MinValue, MaxValue, Zone, Amount
4001, 6000, 0, $0.101
4001, 6000, 1, $0.112
etc.
Put the primary key over the first three fields.
You get many more rows, but a much easier query. And you have
normalized a table and are thus working towards a better database
design.
Once you have done this, the query becomes something like (off the
cuff):
select SqFtPrice + Lot1SqFt * Amount as TotalPrice
from table1 inner join table2 on table1.Zone=tab le2.Zone
where Lot1SqFt between MinValue and MaxValue
Now you can also see that there is no need to store TotalPrice: it is
a calculated value that can easily be computed using the above query.
If you follow this suggestion, you are making a second step towards a
better database design, one without calculated values. Of course there
are sometimes good reasons to store calculated values, for example if
the prices may change and the TotalPrice as it was then needs to be
remembered.
-Tom.
>I have two Access 2003 tables, one has a "Zone" and "Lot1SqFt" that changes with each record. (8,000+ records) A portion of this table: CustomerID ZONE Lot1SqFt SqFtPrice TotalPrice
21 2 27100 $1,599.00 $1,979.00
37 4 15475 $1,068.00 $1,392.00
366 1 17190 $1,187.00 $1,292.00
The other table has fields (columns) for each "Zone" plus a Minimum and Maximum field and "Records" (rows) that denote the size "Lot1SqFt". (14 fields and 8 records) A portion of this table: SqFtMin SqFtMax 0 1 2 3 4
4001 6000 $0.101 $0.112 $0.123 $0.127 $0.130
6001 7000 $0.099 $0.102 $0.116 $0.121 $0.125
7001 20000 $0.097 $0.107 $0.097 $0.087 $0.097 20001 50000 $0.090 $0.099 $0.096 $0.076 $0.086
I need to have Access find the right value, in the 2nd table, for the two values from the 1st table and use that value to determine the TotalPrice (as we move through the records)
Examples: (Maybe not needed) Zone 2 with a Lot1SqFt of 27100 has a value of $0.096 which gives a TotalPrice of $2,601.60 Zone 4: Lot1SqFt of 15475 with a value of .097 = $1,501.08 Zone 1 is 17190 and .099 gives $1,701.81
This is straight-forward to the human mind - - - but my mind doesn't know how to have Access do this! Can anyone help me with this?
On May 29, 9:08 pm, Deac <mwal...@kconli ne.comwrote:
I have two Access 2003 tables, one has a "Zone" and "Lot1SqFt" that
changes with each record. (8,000+ records)
A portion of this table:
CustomerID ZONE Lot1SqFt SqFtPrice TotalPrice
21 2 27100 $1,599.00
$1,979.00
37 4 15475 $1,068.00
$1,392.00
366 1 17190 $1,187.00
$1,292.00
The other table has fields (columns) for each "Zone" plus a Minimum
and Maximum field and "Records" (rows) that denote the size
"Lot1SqFt". (14 fields and 8 records)
A portion of this table:
SqFtMin SqFtMax 0 1 2
3 4
4001 6000 $0.101 $0.112 $0.123 $0.127 $0.130
6001 7000 $0.099 $0.102 $0.116 $0.121 $0.125
7001 20000 $0.097 $0.107 $0.097 $0.087 $0.097
20001 50000 $0.090 $0.099 $0.096 $0.076 $0.086
I need to have Access find the right value, in the 2nd table, for the
two values from the 1st table and use that value to determine the
TotalPrice (as we move through the records)
Examples: (Maybe not needed)
Zone 2 with a Lot1SqFt of 27100 has a value of $0.096 which gives
a TotalPrice of $2,601.60
Zone 4: Lot1SqFt of 15475 with a value of .097 = $1,501.08
Zone 1 is 17190 and .099 gives $1,701.81
This is straight-forward to the human mind - - - but my mind doesn't
know how to have Access do this! Can anyone help me with this?
We answered this already. If you don't want to take our advice, don't
ask for it. I spent 10 minutes laying it all out for any idiot to
understand. Apparently you're the exception to the rule.
The table is designed incorrectly. Get that through your thick
skull. Redesign the table as Tom (and some of us before him) has
suggested and then come back and ask the question if it still exists.
However, once you properly redesign the table you won't have this
question anymore.
Database layout is best left to professionals. This is a prime
example I'm going to use from now on. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nick Dreyer |
last post by:
In VB.NET I would like to not have to create property get/set procedures for
every class variable I want to expose to Excel VBA projects in COM builds.
Can anyone tell me if that is possible, or refer me to some documents that
will make me understand why this apparent limitation of VB.NET COM builds is
acceptable, i.e. why in "good" object code programs I should expect to never
have to create large numbers of public class variables that...
|
by: Oliver Bryant |
last post by:
I just finished developing a javascipt component allowing floating
captions to appear over HTML elements.
If anyone wants to check it out you can see specs and download it from
http://boxover.swazz.org.
There is a demo there as well.
|
by: Mark Sandfox |
last post by:
I have a simple framed site with a Banner, Contents, & Main frames. The
contents page is an .aspx page that queries an MS Access database and dumps
its results into varios Dropdownlists and 1 Listbox. The users would select
from the list then click a button and the Table of Contents is updated
(works perfectly). The problem is that I can not get it to call a page to
the "main" frame. Redirect as I understand it will not redirect to a...
|
by: kaosyeti |
last post by:
it may be because i'm having a BAD day but i can't come up with an easy way
to do this...
i want to have a form for recording one department's yearly forecasted data.
what i have is a column of months, to the right of which i have two text
boxes for entering units and gross. the thing is the only way i could think
of to get this into a table was to have a table with a field for each
separate text box. so i have:
form:
|
by: google |
last post by:
I am creating a new database for use within our company, that I'd like
to make reasonably secure (short of a true server based solution). The
back-end of a non-server based database seems to be the biggest
security hole, due to the ease of opening, linking, and/or importing
raw data directly from the back-end database. I've read information
that indicates that locking down the back-end tables to the owner, then
using RWOP queries in the...
| |
by: Wayne |
last post by:
I am a one man enterprise and have been asked by a prospective client
what happens to their database regarding ongoing changes etc if I get
hit by a bus.
Obviously my databases are distributed as mde files in an effort to
protect my intellectual property. How do I give the client peace of
mind, short of giving them a backup mdb file that any programmer could
work on to provide required changes etc if I wasn't around?
Of course this...
|
by: Rick Stevens |
last post by:
I am not an access expert, could anyone tell me if the following would be
easy to do??
I receive emails from a specific email address, that advise me if a specific
piece of equipment my company maintains has failed. I also then get emails
telling me when this equipment is back working again.
All of this information is held within the body of the email.
I would like to make this more graphical instead of filtering through
|
by: raylopez99 |
last post by:
Inspired by Chapter 8 of Albahari's excellent C#3.0 in a Nutshell
(this book is amazing, you must get it if you have to buy but one C#
book) as well as Appendix A of Jon Skeet's book, I am going through
some LINQ queries. But how to cast? (
See the below, modified from somebody else's code.
The problem is the query 'stops' (throws a cast exception) at "3", and
never gets to "violet".
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |