Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / September 2006

Tip: Looking for answers? Try searching our database.

IIF function not working properly in my access database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
blue - 30 Sep 2006 15:48 GMT
I am trying to find out the delay in days occurred between two date
fields in an MS ACCESS 2003 Query.
ScheduledDateforProductApprovalbyOBI:IIf([ActualProductSubmittalDate]<([ScheduledDateToPlaceOrder]-10),(IIf(([ScheduledDateToPlaceOrder]-([ActualProductSubmittalDate]+15))<5,[ScheduledDateToPlaceOrder]-5,[ActualProductSubmittalDate]+15),[ActualProductSubmittalDate]+7)

this is the IIF function i have used to find the delay. Can anybody
advise me where is the mistake in this function.
Duane Hookom - 30 Sep 2006 17:11 GMT
I think you should create a small user-defined function rather than
attempting to create business calculations in an expression in a query. I
expect the numbers may change at some point in the future and you should
never have to go back to a query to make the changes.

You can open a new, blank module and begin by entering:

Public Function GetSDPABOBI(datAPSD as Date, datSDTPO as Date) As Date
   If datAPSD<datSDTPO -10 Then
       'other code
   End If
End Function

Signature

Duane Hookom
MS Access MVP

>I am trying to find out the delay in days occurred between two date
> fields in an MS ACCESS 2003 Query.
> ScheduledDateforProductApprovalbyOBI:IIf([ActualProductSubmittalDate]<([ScheduledDateToPlaceOrder]-10),(IIf(([ScheduledDateToPlaceOrder]-([ActualProductSubmittalDate]+15))<5,[ScheduledDateToPlaceOrder]-5,[ActualProductSubmittalDate]+15),[ActualProductSubmittalDate]+7)
>
> this is the IIF function i have used to find the delay. Can anybody
> advise me where is the mistake in this function.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.