Results 1 to 3 of 3
  1. #1
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2003
    Join Date
    Jun 2016
    Posts
    237

    Query based on a condition from a form

    Hi everyone.

    I have query with criteria based on two dates (txtStartDate, txtEndDate), The query has the following criteria:
    Between [Forms]![frmFormNameDialogue]![txtStartDate] And [Forms]![frmFormNameDialogue]![txtEndDate]

    If the dates are selected, the query will run and display the record based on the condition.
    What I want is:
    Show all records if no dates are specified.

    How can this be done?

    Khalil

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    If IsNull(me.txtstartDate) then
    Docmd.openquery "qsAllRecs"
    Else
    Docmd.openquery "qsDateRange"
    end if

  3. #3
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2003
    Join Date
    Jun 2016
    Posts
    237
    Thanks,
    What you wrote helped to get it done .

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

Similar Threads

  1. Select An Update Query Based on Condition
    By djmixer135 in forum Queries
    Replies: 4
    Last Post: 04-15-2019, 10:08 AM
  2. Lookup Field in Query based on condition
    By jkk17 in forum Queries
    Replies: 2
    Last Post: 04-02-2015, 06:58 AM
  3. Marco Condition based off a Query
    By bigbox486 in forum Macros
    Replies: 1
    Last Post: 03-30-2015, 09:02 AM
  4. Add Query Based on if Condition
    By shakeelmscw in forum Queries
    Replies: 17
    Last Post: 01-18-2013, 02:35 AM
  5. Replies: 3
    Last Post: 11-19-2010, 01:48 PM

Tags for this Thread

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