Rabu, 30 Desember 2015

Re: [MS_AccessPros] Is there a more 'elegant' way todo this

 


Thanks Duane and John,
That's what I was looking for. I knew there had to be something better than what I was doing.
Sarah

---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

There's also the Switch function:

=Switch([Type]="W", "Warehouse", [Type]="C", "Cutter", [Type]="V", "Vendor)

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)



On Dec 30, 2015, at 5:24 AM, Duane Hookom duanehookom@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

If you don't want to do this the proper way ;-) then you can use this less wordy solution:
 
=Choose(Instr(1,"WCV",[Type])+1,"Other","Warehouse","Cutter","Vendor")
 
 
Duane Hookom, MVP
MS Access
 

To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Tue, 29 Dec 2015 17:30:03 -0800
Subject: Re: [MS_AccessPros] Is there a more 'elegant' way todo this




I think I'll leave it for now, with 4 choices it's not so bad.
Thanks
Sarah

---In MS_Access_Professionals@yahoogroups.com, <duanehookom@...> wrote :

I would create a small lookup table and include it in the report's record source query. When there are more than 4 options, maintain your table rather than an expression. 

IMO, this is the only solution ;-)

Duane

Sent from Outlook Mobile




On Tue, Dec 29, 2015 at 4:14 PM -0800, "sarahk@... [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:



I am populating a text box on a report as follows:


=IIf([Type]="W","Warehouse",IIf([Type]="C","Cutter",IIf([Type]="V","Vendor","Other")))



The Type field can have 4 different values: W,C,V,O.


I use a value list in my form, but for the report I used the IIF statement. 


I have a feeling there is a 'better' way to do this, but I could not figure it out.




Thanks


Sarah









__._,_.___

Posted by: sarahk@schemesoftware.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)

.

__,_._,___

Tidak ada komentar:

Posting Komentar