Results 1 to 3 of 3
  1. #1
    mesba713 is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2015
    Posts
    5

    Search form not working corerctly with dates

    Hallo Everyone,
    I am really new to access and is overwhelmed with this probably simple query.
    I have one table and a form based on this table.
    In this form the user can select different criteria to filter the result.
    But the Problem is with the fields [Forms]![Vergabeumfang]![500_Termin_von_Box] and [Forms]![Vergabeumfang]![500_Termin_Bis_Box]
    its date from and date to . the user should be able to see the records within these dates. But if they are empty then all the records should be shown regardless if they are empty or filled with regards to the other criteria in the form like "((Vergabeumfang.V_Einkauf_Name)" but when i leave it empty the query shows only the records where Vergabeumfang.[500_Plan]) is empty and not all.



    Any help would be highly appreciated

    SELECT *
    FROM Vergabeumfang
    WHERE (((Vergabeumfang.V_Commodity_Nr) Like "*" & [Forms]![Vergabeumfang]![Commoduity_Nr_Box] & "*") AND ((Vergabeumfang.Einkaufsvorgang_Id) Like "*" & [Forms]![Vergabeumfang]![Vorgang ID box] & "*") AND ((Vergabeumfang.Produktlinien) Like "*" & [Forms]![Vergabeumfang]![Produktlinien Box] & "*") AND ((Vergabeumfang.Entscheidungsmethode) Like "*" & [Forms]![Vergabeumfang]![Entscheidungsmethode_Box] & "*") AND ((Vergabeumfang.Vergabestatus) Like "*" & [Forms]![Vergabeumfang]![Vergabestatus_Box] & "*") AND ((Vergabeumfang.V_Einkauf_Name) Like "*" & [Forms]![Vergabeumfang]![Einkauf_Name_Box] & "*") AND ((Vergabeumfang.V_QMT_Name) Like "*" & [Forms]![Vergabeumfang]![QMT_Name_Box] & "*") AND ((Vergabeumfang.V_Logistik_Name) Like "*" & [Forms]![Vergabeumfang]![Logistik_Name_Box] & "*") AND ((Vergabeumfang.V_Entwicklung_Name) Like "*" & [Forms]![Vergabeumfang]![Entwicklung_Name_Box] & "*") AND ((Vergabeumfang.Einkaufsvorgang) Like "*" & [Forms]![Vergabeumfang]![Einkaufvorgang_Box] & "*")





    AND (IIF( [Forms]![Vergabeumfang]![500_Termin_bis_Box] Is Null and [Forms]![Vergabeumfang]![500_Termin_von_Box] Is Null , (Vergabeumfang.[500_Plan]) Is Null ,
    (Vergabeumfang.[500_Plan]) Between [Forms]![Vergabeumfang]![500_Termin_von_Box] And [Forms]![Vergabeumfang]![500_Termin_bis_Box]
    ) )




    );

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Have you try use "CDATE" or "#" to convert the date string on the form?

    Like
    - CDATE([Forms]![Vergabeumfang]![500_Termin_von_Box])
    - CDATE([Forms]![Vergabeumfang]![500_Termin_Bis_Box])

  3. #3
    mesba713 is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2015
    Posts
    5
    thanks for the advice it was a stupid naming problem in the sql it is solved now .
    Quote Originally Posted by lfpm062010 View Post
    Have you try use "CDATE" or "#" to convert the date string on the form?

    Like
    - CDATE([Forms]![Vergabeumfang]![500_Termin_von_Box])

    - CDATE([Forms]![Vergabeumfang]![500_Termin_Bis_Box])

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

Similar Threads

  1. Search not working in my form
    By scorpion99 in forum Forms
    Replies: 3
    Last Post: 11-06-2014, 01:37 PM
  2. Search Form drop down fields not working
    By wnicole in forum Access
    Replies: 1
    Last Post: 09-19-2013, 07:43 AM
  3. Replies: 18
    Last Post: 01-31-2013, 01:18 PM
  4. Replies: 5
    Last Post: 04-06-2012, 11:06 AM
  5. Search Button in a Form not Working
    By spideynok in forum Forms
    Replies: 30
    Last Post: 03-29-2012, 01:10 AM

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