Connecting Tech Pros Worldwide Help | Site Map

?Issues using DLOOKUP & both negative / positive lookup values?

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 01:32 AM
Tripp Knightly
Guest
 
Posts: n/a
Default ?Issues using DLOOKUP & both negative / positive lookup values?

I have a lookup table from which I want to categorize various bands of
customer net income. Some of the income is positive, some is
negative. The bands vary in size (ie, <500, -200 to 0, 100 to 1000).
When I have a lookup table w/ the "threshold" amounts of income, I'm
not able to get dlookup to work, and I'm pretty sure it's getting
tripped up by negative / positive lookup values. Is it not possible
to do lookups on a table w/ both negatives / positives?

Thanks

  #2  
Old November 13th, 2005, 01:32 AM
PC Datasheet
Guest
 
Posts: n/a
Default Re: ?Issues using DLOOKUP & both negative / positive lookup values?

Your first problem is that your bands are not exclusive. A net income that is
between -200 and 0 is also <500. A net income that is <500 but equal to or
greater than 100 is also between 100 and 1000.

Once you solve that problem, create the following table:
TblNetIncomeBands
NetIncomeBandsID
BandText
LowerValue
UpperValue
etc

BandText is <500, -200 to 0, 100 to 1000

To determine which band a customer's net income falls in, create a query that
includes LowerValue and UpperValue. Put the following expression in the criteria
for LowerValue:
<=[CustomerNetIncome]
Put the following expression in the criteria for UpperValue:[color=blue]
>=[CustomerNetIncome][/color]


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource@pcdatasheet.com
www.pcdatasheet.com

"Tripp Knightly" <trippknightly@hotmail.com> wrote in message
news:120d8f1c.0408021215.f531c26@posting.google.co m...[color=blue]
> I have a lookup table from which I want to categorize various bands of
> customer net income. Some of the income is positive, some is
> negative. The bands vary in size (ie, <500, -200 to 0, 100 to 1000).
> When I have a lookup table w/ the "threshold" amounts of income, I'm
> not able to get dlookup to work, and I'm pretty sure it's getting
> tripped up by negative / positive lookup values. Is it not possible
> to do lookups on a table w/ both negatives / positives?
>
> Thanks[/color]


  #3  
Old November 13th, 2005, 01:33 AM
Tripp Knightly
Guest
 
Posts: n/a
Default Re: ?Issues using DLOOKUP & both negative / positive lookup values?

Thank you. That seems sensible.

I will say that my test code on only positive lookup values and a
sorted lookup table didn't seem to raise an exclusivity issue - the
dlookup would "do the right thing" and pick the first qualifying row /
band. You've lost me on "A net income that is <500 but equal to or[color=blue]
> greater than 100 is also between 100 and 1000". Something can't be <500 and >= 100. Maybe you meant >500?[/color]

Regardless, I can see an alternative approach to try.

I could probably achieve the same just using nested subqueries
(peformance issues or not).

"PC Datasheet" <nospam@nospam.spam> wrote in message news:<GBxPc.23313$iK.20652@newsread2.news.atl.eart hlink.net>...[color=blue]
> Your first problem is that your bands are not exclusive. A net income that is
> between -200 and 0 is also <500. A net income that is <500 but equal to or
> greater than 100 is also between 100 and 1000.
>
> Once you solve that problem, create the following table:
> TblNetIncomeBands
> NetIncomeBandsID
> BandText
> LowerValue
> UpperValue
> etc
>
> BandText is <500, -200 to 0, 100 to 1000
>
> To determine which band a customer's net income falls in, create a query that
> includes LowerValue and UpperValue. Put the following expression in the criteria
> for LowerValue:
> <=[CustomerNetIncome]
> Put the following expression in the criteria for UpperValue:[color=green]
> >=[CustomerNetIncome][/color]
>
>
> --
> PC Datasheet
> Your Resource For Help With Access, Excel And Word Applications
> resource@pcdatasheet.com
> www.pcdatasheet.com
>
> "Tripp Knightly" <trippknightly@hotmail.com> wrote in message
> news:120d8f1c.0408021215.f531c26@posting.google.co m...[color=green]
> > I have a lookup table from which I want to categorize various bands of
> > customer net income. Some of the income is positive, some is
> > negative. The bands vary in size (ie, <500, -200 to 0, 100 to 1000).
> > When I have a lookup table w/ the "threshold" amounts of income, I'm
> > not able to get dlookup to work, and I'm pretty sure it's getting
> > tripped up by negative / positive lookup values. Is it not possible
> > to do lookups on a table w/ both negatives / positives?
> >
> > Thanks[/color][/color]
  #4  
Old November 13th, 2005, 01:33 AM
PC Datasheet
Guest
 
Posts: n/a
Default Re: ?Issues using DLOOKUP & both negative / positive lookup values?

<< Something can't be <500 and >= 100 >>

100 to 499 all are!

Steve
PC Datasheet


"Tripp Knightly" <trippknightly@hotmail.com> wrote in message
news:120d8f1c.0408030944.27125e1d@posting.google.c om...[color=blue]
> Thank you. That seems sensible.
>
> I will say that my test code on only positive lookup values and a
> sorted lookup table didn't seem to raise an exclusivity issue - the
> dlookup would "do the right thing" and pick the first qualifying row /
> band. You've lost me on "A net income that is <500 but equal to or[color=green]
> > greater than 100 is also between 100 and 1000". Something can't be <500 and[/color]
>= 100. Maybe you meant >500?
>
> Regardless, I can see an alternative approach to try.
>
> I could probably achieve the same just using nested subqueries
> (peformance issues or not).
>
> "PC Datasheet" <nospam@nospam.spam> wrote in message[/color]
news:<GBxPc.23313$iK.20652@newsread2.news.atl.eart hlink.net>...[color=blue][color=green]
> > Your first problem is that your bands are not exclusive. A net income that[/color][/color]
is[color=blue][color=green]
> > between -200 and 0 is also <500. A net income that is <500 but equal to or
> > greater than 100 is also between 100 and 1000.
> >
> > Once you solve that problem, create the following table:
> > TblNetIncomeBands
> > NetIncomeBandsID
> > BandText
> > LowerValue
> > UpperValue
> > etc
> >
> > BandText is <500, -200 to 0, 100 to 1000
> >
> > To determine which band a customer's net income falls in, create a query[/color][/color]
that[color=blue][color=green]
> > includes LowerValue and UpperValue. Put the following expression in the[/color][/color]
criteria[color=blue][color=green]
> > for LowerValue:
> > <=[CustomerNetIncome]
> > Put the following expression in the criteria for UpperValue:[color=darkred]
> > >=[CustomerNetIncome][/color]
> >
> >
> > --
> > PC Datasheet
> > Your Resource For Help With Access, Excel And Word Applications
> > resource@pcdatasheet.com
> > www.pcdatasheet.com
> >
> > "Tripp Knightly" <trippknightly@hotmail.com> wrote in message
> > news:120d8f1c.0408021215.f531c26@posting.google.co m...[color=darkred]
> > > I have a lookup table from which I want to categorize various bands of
> > > customer net income. Some of the income is positive, some is
> > > negative. The bands vary in size (ie, <500, -200 to 0, 100 to 1000).
> > > When I have a lookup table w/ the "threshold" amounts of income, I'm
> > > not able to get dlookup to work, and I'm pretty sure it's getting
> > > tripped up by negative / positive lookup values. Is it not possible
> > > to do lookups on a table w/ both negatives / positives?
> > >
> > > Thanks[/color][/color][/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.