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

Is a DLookup the rigth way to go?

I was asked to help a friend with a database and am in over my head!
The customer table has been in place and they have used a paper copy
of the pricing table to make manual changes and computations in the
past (a lot, lot, lot of work!) I'm pretty new at this and am looking
for some help!

There are two tables in a database (of over 8,000 records) - one is
"t_Customers" the other is "t_PricingByZone" (data in this table
changes often).

The "t_Customers" table has two fields "Zone" and "Lot1SqFt" that are
used to determine cost. This part works pretty good and gives what
they need!

sample from "t_Customers"
CustomerID ZONE Lot1SqFt LinearFeet SqFtPrice
LinearPrice TotalPrice
2040 9 10100 50
$696.90 $25.00 $721.90
^^^ ^^^

The t_PricingByZone table has entries for each Zone (0 to 11) while
the fields have headers representing different sizes.

complete table "t_PricingByZone€"
Zone 1200 4000 6000 7000 20000 50000
100000 10000000
0 140 0.12 0.1 0 .089 0.067
0 0 0
1 140 0.12 0.12 0.12 0.069
0.056 0.054 0.052
2 140 0.12 0.125 0.12 0.06
0.057 0.056 0.054
3 140 0.12 0.12 0.142 0.065
0.058 0.056 0.054
4 140 0.13 0.13 0.12 0.067
0.059 0.059 0.057
5 140 0.135 0.135 0.132 0.07
0.06 0.058 0.057
6 140 0.136 0.12 0.12 0.069
0.061 0.056 0.052
7 140 0.137 0.12 0.121 0.068
0.06 0.054 0.052
8 140 0.138 0.111 0.12 0.067
0.059 0.052 0.057
9 140 0.12 0.11 0.12 0.069
0.059 0.051 0.057
10 140 0.12 0.12 0.12 0.069
0.058 0.051 0.052
11 140 0.12 0.12 0.12 0.069
0.059 0.052 0.052
A customer in "Zone" 9 with a "Lot1SqFt" of 10100 square feet has a
multiplier of .069 and would have a "SqFtPrice" of $696.90

(Find the Zone - then the 1st size (Field Name) that the Lot1SqFt is
less than - this will give you the multiplier.)

I'm not even sure if a number field can be used to designate a column
header (or Field Name)

I haven't been able to get the right multiplier using DLookup - I'm
not sure how to use it and don't know if this is the best way to do it
or not!

Any assistance that anyone can give me would be a great to me!!!

May 18 '07 #1
1 1612
rkc
Deac wrote:
I was asked to help a friend with a database and am in over my head!
The customer table has been in place and they have used a paper copy
of the pricing table to make manual changes and computations in the
past (a lot, lot, lot of work!) I'm pretty new at this and am looking
for some help!

There are two tables in a database (of over 8,000 records) - one is
"t_Customers" the other is "t_PricingByZone" (data in this table
changes often).

The "t_Customers" table has two fields "Zone" and "Lot1SqFt" that are
used to determine cost. This part works pretty good and gives what
they need!

sample from "t_Customers"
CustomerID ZONE Lot1SqFt LinearFeet SqFtPrice
LinearPrice TotalPrice
2040 9 10100 50
$696.90 $25.00 $721.90
^^^ ^^^

The t_PricingByZone table has entries for each Zone (0 to 11) while
the fields have headers representing different sizes.

complete table "t_PricingByZone€"
Zone 1200 4000 6000 7000 20000 50000
100000 10000000
0 140 0.12 0.1 0 .089 0.067
0 0 0
1 140 0.12 0.12 0.12 0.069
0.056 0.054 0.052
2 140 0.12 0.125 0.12 0.06
0.057 0.056 0.054
3 140 0.12 0.12 0.142 0.065
0.058 0.056 0.054
4 140 0.13 0.13 0.12 0.067
0.059 0.059 0.057
5 140 0.135 0.135 0.132 0.07
0.06 0.058 0.057
6 140 0.136 0.12 0.12 0.069
0.061 0.056 0.052
7 140 0.137 0.12 0.121 0.068
0.06 0.054 0.052
8 140 0.138 0.111 0.12 0.067
0.059 0.052 0.057
9 140 0.12 0.11 0.12 0.069
0.059 0.051 0.057
10 140 0.12 0.12 0.12 0.069
0.058 0.051 0.052
11 140 0.12 0.12 0.12 0.069
0.059 0.052 0.052
A customer in "Zone" 9 with a "Lot1SqFt" of 10100 square feet has a
multiplier of .069 and would have a "SqFtPrice" of $696.90

(Find the Zone - then the 1st size (Field Name) that the Lot1SqFt is
less than - this will give you the multiplier.)

I'm not even sure if a number field can be used to designate a column
header (or Field Name)

I haven't been able to get the right multiplier using DLookup - I'm
not sure how to use it and don't know if this is the best way to do it
or not!

Any assistance that anyone can give me would be a great to me!!!
In a nutshell what you are doing is not the way things are done in a
relational database. You have data in your field names.
Square footage is data. The values 1200, 4000, 6000 are data not field
names.

Closer to what you want is

PricingByZone(Zone*, SqFtMin*, SqFtMax*, Multiplier)

0 1200 3999 140
0 4000 5999 0.12
0 6000 6999 1.0
9 20000 4999 0.69
Then, since I find writing a query easier than figuring out how
Dlookup works, something like

[Air Code]

Parameters SqFt Long;
SELECT Multiplier
FROM PricingByZone
WHERE [SqFt] BETWEEN SqFtMin AND SqFtMax

A shot in the dark at a Dlookup to do the same:

DLookup ("[Multiplier]", "PricingByZone","
& SqFt & " Between SqFtMin And SqFtMax")

[/Air Code]


May 18 '07 #2

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

Similar topics

13
by: denis wendum | last post by:
In a nutshell: What is the equivalent of __radd__ (wich overloads the right hand side of +) when overloading the comparison operators <,>,== and so on. My first guess __rlt__ for overloading the...
1
by: KLAU | last post by:
I have a field that retrieves information from an expression in a query. I have used a DLookup function to get the calculated field from the query. However, the relationship is 1-to-many so one...
4
by: MLH | last post by:
I have tried using DLookUp in this manner... If DLookUp("","tblClients","='2021234567'") Then MsgBox "Found it!" End If I am wondering if that is a misuse of the DLookUp command? Type...
2
by: ctyrrell | last post by:
I have read with interest the many discussions of the 3048 Error: Cannot open any more databases. I understand how the number of open Table ID's causes the problem. My question has to do with the...
8
by: Christine Henderson | last post by:
I have a problem using the above function in the following simplified circumstance: In the lookup table called "Klms Travelled" I have 3 fields, eg: Receiver Name Receiver Suburb ...
11
by: MLH | last post by:
DLookup("", "tblPreliminaryVINs", "=Forms!frmVINODO!SerialNum") is giving me a Type Mismatch error. That's confusing to me and I don't know how to circumvent it. The field in...
2
by: Don | last post by:
Can someone help me fix my DLookup problem. I'm far from proficiency with Access. I've been creating databases for several years for work with the help of many of you and trial and error. I have...
9
by: | last post by:
In my database I have a 'control table' in which basic info is stored about the application, for instance the application's path and the name of the company that is using it. In all of the...
15
by: rleepac | last post by:
This is a little complicated but I'll do my best to explain. In my db I have a table called L_AgeCorrection which has the following fields: Age, Sex, Frequency, AgeValue This is a table used to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.