Results 1 to 5 of 5

Thread: Help needed in Iff Statement for Access!

  1. #1
    Join Date
    Aug 2006
    Posts
    114

    Help needed in Iff Statement for Access!

    Hi friends,
    I have done some basic things in Access, but I am not having enough knowledge about it. I have created a database which is having the records being used by the Date Completed. In this I am storing the Date at which the task is completed. I have written a command that can retrieve the months from my field date. I am doing that because I want to show the first 3 months or last 3 months. I have used the Iff Statement in Access for the same purpose.!! Hoping for help faster..!!
    |===================|
    |YAY if that made sense...|
    |===================|

  2. #2
    Join Date
    Mar 2008
    Posts
    672

    Re: Help needed in Iff Statement for Access!

    It would be better to me (and others) if you provide the command that you are using.!! Because no one can come to know exact what is causing the issue.!! I think that you should have information about the IIf statement. You can use IIf anywhere you can use expressions. You use IIf to determine if another expression is true or false. So this can be useful for checking the condition. If the expression is true, IIf returns one value; if it is false, IIf returns another. I am giving the syntax for the same :
    Code:
    IIf(expr, truepart, falsepart)

  3. #3
    Join Date
    Aug 2006
    Posts
    114

    Re: Help needed in Iff Statement for Access!

    Thanks for replying me..!! Here is the sample of my query which I was talking about :
    Code:
    Date: IIf([Month]="January" And " February" And "March" And "April" And "May" And "June",
    "First 3 Months","Last 3 Months")
    I have also tried 'or' instead of 'and', but still no success.!! Help me.
    |===================|
    |YAY if that made sense...|
    |===================|

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Help needed in Iff Statement for Access!

    I think that you must use "OR", since the month cannot take the different values at the same time. I think that you must try to give the numbers instead of names to months. If you do that, then your query should be like this :
    Code:
    Date: iif(Month < 4 ,"First 3 Months","Last 3 Months")
    Hope that this helps.!!

  5. #5
    Join Date
    Aug 2006
    Posts
    235

    Re: Help needed in Iff Statement for Access!

    I think that using the above solution provided by the 'Reegan' for your problem would be better. You should also know that when your data can hold multiple years, you must append the year. If you don't do this then calculated values will be wrong. I think that same thing is happening in your case. Hope that this can solve your issue.
    3.2 (northwood)
    2gig ram
    ATI AIW X800xt 256mb
    Gigabyte GA-8knxp 875p Chipset
    Optiwrite 8X DVD Burner
    Win XP PRO Sp2 (Works Perfectly)
    2 SATA Raptor 74gig Raid 0
    2 7200 IDE 320gig HD

Similar Threads

  1. Urgent help needed! Cannot access server with non-domain computers.
    By jeffr1987 in forum Networking & Security
    Replies: 1
    Last Post: 20-04-2011, 06:05 PM
  2. How to use Else and Else If Statement in PHP?
    By Orton in forum Software Development
    Replies: 5
    Last Post: 05-03-2010, 06:49 AM
  3. How to use If statement in PHP?
    By Deabelos in forum Software Development
    Replies: 4
    Last Post: 09-02-2010, 06:14 AM
  4. Password needed to access Entourage after installing Leopard
    By Triple-X in forum Operating Systems
    Replies: 3
    Last Post: 30-10-2009, 09:37 PM
  5. Replies: 4
    Last Post: 25-02-2009, 08:52 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,536,524.57884 seconds with 17 queries