Results 1 to 12 of 12
  1. #1
    sychobob is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2016
    Posts
    8

    iif question

    IIF([Formulaires]![FORMULAIRE_SOMMAIRE_GARAGE]![TEXTE_DATE_DEBUT_REQ_SOMMAIRE_GARAGE] IS NULL,>="",>=[Formulaires]![FORMULAIRE_SOMMAIRE_GARAGE]![TEXTE_DATE_DEBUT_REQ_SOMMAIRE_GARAGE] Et <=[Formulaires]![FORMULAIRE_SOMMAIRE_GARAGE]![TEXTE_DATE_FIN_REQ_SOMMAIRE_GARAGE])


    Hi hope someone can help me with this, want my query to look if something is entered in a form ([Formulaires]![FORMULAIRE_SOMMAIRE_GARAGE]![TEXTE_DATE_DEBUT_REQ_SOMMAIRE_GARAGE]) if nothing is entered I want the query to run without any criteria


    Click image for larger version. 

Name:	problem.jpg 
Views:	16 
Size:	163.4 KB 
ID:	26459

    thanks hope someone will figure out why this isnt working

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Instead of trying to filter in the query, filter from the form. The query would pull all items,
    but when user picks items in the form,filter it then.....

    Code:
    sub btnFilter_click()
      Me.filter = "[field] is null and [field2]='X'"
      me.filterOn= true
    end sub

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    sychobob is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2016
    Posts
    8
    too newbe to understant your technique ranman256 but I appreciate the response

    pbaldy:
    tried that technique but it is still prompting me to enter data when nothing is entered in the form with this line...is there something I am doing wrong?
    >=[Formulaires]![FORMULAIRE_SOMMAIRE_GARAGE]![TEXTE_DATE_DEBUT_REQ_SOMMAIRE_GARAGE] AND <=[Formulaires]![FORMULAIRE_SOMMAIRE_GARAGE]![TEXTE_DATE_FIN_REQ_SOMMAIRE_GARAGE] Ou [Formulaires]![FORMULAIRE_SOMMAIRE_GARAGE]![TEXTE_DATE_DEBUT_REQ_SOMMAIRE_GARAGE] IS Null

  5. #5
    sychobob is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2016
    Posts
    8
    If I just click ok on both prompts I am getting the right return results which is an improvement from what I was trying but would like to simply avoid the promps as it will be annoying for the rest of the application I am making

  6. #6
    sychobob is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2016
    Posts
    8
    between Nz([Formulaires]![FORMULAIRE_SOMMAIRE_GARAGE]![TEXTE_DATE_DEBUT_REQ_SOMMAIRE_GARAGE],#1900-01-01#) AND nz([Formulaires]![FORMULAIRE_SOMMAIRE_GARAGE]![TEXTE_DATE_FIN_REQ_SOMMAIRE_GARAGE],#2100-01-01#)

    Also tried this and still getting prompts

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The prompts mean Access can't find something. Did you use the Build function to make sure the spelling and syntax is correct? Is the form open when the query runs?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    sychobob is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2016
    Posts
    8
    pbaldy: I know that is the point of what I am trying to do, if I use the form and enter dates it will send back the data within the date parameter but if another part of the application uses it I want all the data to show up and not be prompted to enter dates or hit ok twice.

    Just ran tests to make sure, yes the query works if both dates are entered and returns the correct information, but I still get the prompt if another part of my application uses the same query.

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Is that form open when the other part of the application runs the query? It has to be or you'll get prompted. If the form won't be open, you may want to use ranman's method or something else.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    sychobob is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2016
    Posts
    8
    no it's not...just tried through the form not entering data and was not prompted to enter anything...guess i<ll have to figure out how to make ranman's method to work

  11. #11
    sychobob is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2016
    Posts
    8
    thanks for your help both of you

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    One option is to use controls on a form that's always open (they can be hidden). You can copy values to that form (or empty them), then run the query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 08-25-2012, 07:19 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