Thank you
From: "Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: Access Professionals Yahoo Group <ms_access_professionals@yahoogroups.com>
Sent: Thursday, August 13, 2015 10:15 AM
Subject: RE: [MS_AccessPros] Re: Populate a field according to value of two other fields.
Kambiz
From: "Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: Access Professionals Yahoo Group <ms_access_professionals@yahoogroups.com>
Sent: Thursday, August 13, 2015 10:15 AM
Subject: RE: [MS_AccessPros] Re: Populate a field according to value of two other fields.
I usually return NULL rather than "" depending on usage.
SELECT IIf([FieldA]="Kaiser" and [FieldB]="Doctor", "Visit",IIf([FieldB]="Fee","Payment",NULL)) As myResult
FROM myTable
Any time I find myself trying to nest IIf()s or hard-code values, I think it's time to create a small user-defined function saved in a module named "modBusinessCalcs".
Duane Hookom, MVP
MS Access
From: MS_Access_Professionals@yahoogroups.com
Date: Wed, 12 Aug 2015 14:43:08 -0700
Subject: [MS_AccessPros] Re: Populate a field according to value of two other fields.
You can do this in a query like this:
Date: Wed, 12 Aug 2015 14:43:08 -0700
Subject: [MS_AccessPros] Re: Populate a field according to value of two other fields.
IIf takes 3 parts. Part 1 = epression, Part2 is return if expression is true, Part3 is returned if expression is false. You can nest IIf statements.
SELECT IIf([FieldA]="Kaiser" and [FieldB]="Doctor", "Visit",IIf([FieldB]="Fee","Payment","")) As myResult
FROM myTable
__._,_.___
Posted by: Kambiz Afshartous <kenaf42@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar