Results 1 to 13 of 13
  1. #1
    claysea is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    20

    Pulling hair out.....


    I want to have an expression that says...

    If [Invoice Date] IS NOT NULL and [Date Paid] IS NULL, then return the name of the month (i.e., March) from [Date of Service] field.

    Also, it's possible that invoiced for 5 different months and not one of them has been paid on, therefore the formula above would need to return all 5 month's names...not just one. (i.e., March, April, May, June, July)

    Does that make sense?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Where are you placing your expression?

    An IF THEN statement behind a form would look like this

    If IsNull(Me.Txt1) AND IsNull(Me.Txt2) then
    Exit Sub
    end IF

  3. #3
    claysea is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    20
    Quote Originally Posted by ItsMe View Post
    Where are you placing your expression?

    An IF THEN statement behind a form would look like this

    If IsNull(Me.Txt1) AND IsNull(Me.Txt2) then
    Exit Sub
    end IF
    This is what I have...and I know it's crap, but I don't know else how to write it. :-(


    =IIf(IsNotNull([Invoice Date:] & IsNull([Date Paid:])), =DatePart("mm", [Date of Service:]), " ")

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I don't know either. Where are you placing this?

    At a glance.....

    =IIf(IsNotNull

    may need to be

    =IIf(Not IsNull

  5. #5
    claysea is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    20
    I am putting it in a Report that pulls information from a table.

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    This is untested, but try:
    Iif Not IsNull([Invoice Date]) AND IsNull([Date Paid]),Month([Date of Service],"")

    If [Invoice Date] IS NOT NULL and [Date Paid] IS NULL, then this should return the number value of the month from [Date of Service] field.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Thank you Mr. Fitz

  8. #8
    claysea is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    20
    Mr. Fitz,

    I get the following error message when I paste your formula in....any ideas?

    "You must enclose IIF function arguements in parentheses"

  9. #9
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Sorry, how about:
    Iif(Not IsNull([Invoice Date]) AND IsNull([Date Paid]),Month([Date of Service]),"")
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  10. #10
    claysea is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    20
    Quote Originally Posted by Bob Fitz View Post
    Sorry, how about:
    Iif(Not IsNull([Invoice Date]) AND IsNull([Date Paid]),Month([Date of Service]),"")
    Sorry...It doesn't produce anything; that field is still blank.

  11. #11
    claysea is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    20
    I got a little further with this one:

    =IIf(Not IsNull([Balance Due:]),([Date of Service:]),"")

    The problem is...that it returns the very first date of service (ever) for that customer; instead of just the months he owes a balance.

  12. #12
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Well it sounds like the syntax is squared away for the most part.

    I am still curious where you are putting this. I understand now it is in a report. Is it in an unbound textbox? Is it in a footer to a detail?

  13. #13
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I would have this in the query for the report, not in a control on the report. Something like

    UnPaidMonth:=IIf(Not IsNull([Balance Due:]),Format(([Date of Service:]),"mm"),"")


    If [Invoice Date] IS NOT NULL and [Date Paid] IS NULL, then return the name of the month (i.e., March) from [Date of Service] field.

    Also, it's possible that invoiced for 5 different months and not one of them has been paid on, therefore the formula above would need to return all 5 month's names...not just one. (i.e., March, April, May, June, July)
    If you want ALL unpaid month names, you will have to write a UDF.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. ^^^Pulling out my hair with a form!!!
    By Casper2012 in forum Forms
    Replies: 7
    Last Post: 08-12-2011, 12:59 PM
  2. access newbie pulling his hair out
    By merchantguy in forum Forms
    Replies: 3
    Last Post: 12-30-2010, 05:57 PM
  3. Query not pulling at all
    By ricardo9211 in forum Queries
    Replies: 3
    Last Post: 02-20-2010, 04:13 AM
  4. Pulling value
    By Overdive in forum Forms
    Replies: 3
    Last Post: 11-08-2009, 03:07 PM
  5. Pulling out duplicates
    By FREEEEEEDOM in forum Access
    Replies: 1
    Last Post: 04-21-2009, 10:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums