Rabu, 13 Januari 2016

Re: Re: [MS_AccessPros] IIF


Thanks a lot for your reply. I just found out that I missed a ")" after 96. That causes the problem. Thanks again.
Best Regards,

Date: 2016-01-13 18:20
Subject: Re: [MS_AccessPros] IIF


Tough to help if you don't tell us what you expect to get.  And what is ELookup?

Your expression basically says:

If TypeID = 1 then "ELookup" where ReportTextID is 1
If TypeID = 2 then "ELookup" where ReportTextID is 96
If TypeID = 3 then "Elookup" where ReportTextID is 97

.. but you have nothing defined if none of the three is true.
Maybe you want:

=IIf([ItineraryRemarkTypeID]=1,ELookup("ReportText","tblReportText","ReportTextID=" & 1),IIf([ItineraryRemarkTypeID]=2,ELookup("ReportText","tblReportText","ReportTextID=" & 96,IIf([ItineraryRemarkTypeID]=3,ELookup("ReportText","tblReportText","ReportTextID=" & 97), "Invalid Type ID"))))

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 Jan 13, 2016, at 10:22 AM, 'zhaoliqingoffice@163.com' zhaoliqingoffice@163.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Dear All,
Please check what wrong with my code, I didn't get the expected result. Thanks in advance.
=IIf([ItineraryRemarkTypeID]=1,ELookup("ReportText","tblReportText","ReportTextID=" & 1),IIf([ItineraryRemarkTypeID]=2,ELookup("ReportText","tblReportText","ReportTextID=" & 96,IIf([ItineraryRemarkTypeID]=3,ELookup("ReportText","tblReportText","ReportTextID=" & 97)))))
Best Regards,


Posted by: "zhaoliqingoffice@163.com" <zhaoliqingoffice@163.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)



Tidak ada komentar:

Poskan Komentar