PC Review


Reply
Thread Tools Rate Thread

"Build" expression in Query

 
 
GoBrowns!
Guest
Posts: n/a
 
      24th Jun 2009

I need to build an expression in my query that says this:

If SupplyPoint = "LaGrange" and Status = "Y6", "SD63"
If SupplyPoint = "Mentor" and Status = "Y6", "3611"
If SupplyPoint = "Traded Goods" and Status = "Y6", "3601".

I would like this to be all in one expression, if possible.

Here was my attempt:

Expr1: IIf(([Supply_Point]="LaGrange" &
[Status]="Y6","SD63"),([Supply_Point]="Mentor" & [Status]="Y6","3611"),"3601")

Any ideas?

Thanks!

 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      24th Jun 2009

What value do you want if the condition's not met? The following assumes
Null...

Expr1: IIf([Status] = "Y6", Switch([Supply_Point]="LaGrange", "SD63",
[Supply_Point]="Mentor", "3611", [Supply_Point]="Traded Goods","3601"),
Null)


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"GoBrowns!" <(E-Mail Removed)> wrote in message
news:51E07D63-0993-4BE0-9793-(E-Mail Removed)...
>I need to build an expression in my query that says this:
>
> If SupplyPoint = "LaGrange" and Status = "Y6", "SD63"
> If SupplyPoint = "Mentor" and Status = "Y6", "3611"
> If SupplyPoint = "Traded Goods" and Status = "Y6", "3601".
>
> I would like this to be all in one expression, if possible.
>
> Here was my attempt:
>
> Expr1: IIf(([Supply_Point]="LaGrange" &
> [Status]="Y6","SD63"),([Supply_Point]="Mentor" &
> [Status]="Y6","3611"),"3601")
>
> Any ideas?
>
> Thanks!
>



 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      24th Jun 2009

I hope there are no Nulls in that table.
Result: IIf(([Supply_Point]="LaGrange" And
[Status]="Y6"),"SD63",IIf(([Supply_Point]="Mentor" And
[Status]="Y6"),"3611","3601"))

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Douglas J. Steele" wrote:

> What value do you want if the condition's not met? The following assumes
> Null...
>
> Expr1: IIf([Status] = "Y6", Switch([Supply_Point]="LaGrange", "SD63",
> [Supply_Point]="Mentor", "3611", [Supply_Point]="Traded Goods","3601"),
> Null)
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "GoBrowns!" <(E-Mail Removed)> wrote in message
> news:51E07D63-0993-4BE0-9793-(E-Mail Removed)...
> >I need to build an expression in my query that says this:
> >
> > If SupplyPoint = "LaGrange" and Status = "Y6", "SD63"
> > If SupplyPoint = "Mentor" and Status = "Y6", "3611"
> > If SupplyPoint = "Traded Goods" and Status = "Y6", "3601".
> >
> > I would like this to be all in one expression, if possible.
> >
> > Here was my attempt:
> >
> > Expr1: IIf(([Supply_Point]="LaGrange" &
> > [Status]="Y6","SD63"),([Supply_Point]="Mentor" &
> > [Status]="Y6","3611"),"3601")
> >
> > Any ideas?
> >
> > Thanks!
> >

>
>
>

 
Reply With Quote
 
BTU_needs_assistance_43
Guest
Posts: n/a
 
      25th Jun 2009

What does the program do if that condition isn't met in the way you wrote it?

"Douglas J. Steele" wrote:

> What value do you want if the condition's not met? The following assumes
> Null...
>
> Expr1: IIf([Status] = "Y6", Switch([Supply_Point]="LaGrange", "SD63",
> [Supply_Point]="Mentor", "3611", [Supply_Point]="Traded Goods","3601"),
> Null)
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "GoBrowns!" <(E-Mail Removed)> wrote in message
> news:51E07D63-0993-4BE0-9793-(E-Mail Removed)...
> >I need to build an expression in my query that says this:
> >
> > If SupplyPoint = "LaGrange" and Status = "Y6", "SD63"
> > If SupplyPoint = "Mentor" and Status = "Y6", "3611"
> > If SupplyPoint = "Traded Goods" and Status = "Y6", "3601".
> >
> > I would like this to be all in one expression, if possible.
> >
> > Here was my attempt:
> >
> > Expr1: IIf(([Supply_Point]="LaGrange" &
> > [Status]="Y6","SD63"),([Supply_Point]="Mentor" &
> > [Status]="Y6","3611"),"3601")
> >
> > Any ideas?
> >
> > Thanks!
> >

>
>
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      25th Jun 2009

It returns Null.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"BTU_needs_assistance_43" <(E-Mail Removed)>
wrote in message news:133E4EEC-D528-4AE8-B57C-(E-Mail Removed)...
> What does the program do if that condition isn't met in the way you wrote
> it?
>
> "Douglas J. Steele" wrote:
>
>> What value do you want if the condition's not met? The following assumes
>> Null...
>>
>> Expr1: IIf([Status] = "Y6", Switch([Supply_Point]="LaGrange", "SD63",
>> [Supply_Point]="Mentor", "3611", [Supply_Point]="Traded Goods","3601"),
>> Null)
>>
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "GoBrowns!" <(E-Mail Removed)> wrote in message
>> news:51E07D63-0993-4BE0-9793-(E-Mail Removed)...
>> >I need to build an expression in my query that says this:
>> >
>> > If SupplyPoint = "LaGrange" and Status = "Y6", "SD63"
>> > If SupplyPoint = "Mentor" and Status = "Y6", "3611"
>> > If SupplyPoint = "Traded Goods" and Status = "Y6", "3601".
>> >
>> > I would like this to be all in one expression, if possible.
>> >
>> > Here was my attempt:
>> >
>> > Expr1: IIf(([Supply_Point]="LaGrange" &
>> > [Status]="Y6","SD63"),([Supply_Point]="Mentor" &
>> > [Status]="Y6","3611"),"3601")
>> >
>> > Any ideas?
>> >
>> > Thanks!
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Report "Control Source" Build Expression Box doesn't work/works DogmaDot Microsoft Access 1 3rd Sep 2009 05:51 PM
Build Expression using multiple Queries and "Between/And" SA wannabe nerdgirl Microsoft Access Getting Started 8 16th Apr 2009 02:59 PM
Can I create a "Sum" on an expression that is "Counting" in query? =?Utf-8?B?ZW1hbm5h?= Microsoft Access Queries 1 14th Jun 2006 09:44 PM
query error "Data type mismatch in criteria expression" on sum Igor Barbaric Microsoft Access 2 27th Jan 2006 12:23 PM
In query, getting "Data type mismatch in criteria expression" mess =?Utf-8?B?anNjY29ycHM=?= Microsoft Access Queries 2 14th Dec 2004 11:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:23 PM.