Results 1 to 7 of 7
  1. #1
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276

    Date Problem In Union Query

    I have created a Union Query. What Should I add to the following that it only shows the "Description" & "Item Description" added after 3/1/2015 up to the current date


    SELECT [Description], [From Date]


    FROM [Price List]
    UNION ALL SELECT [Item Description], [RetItmDte]
    FROM [RetItemItemDescription];

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    try

    Code:
    SELECT [Description], [From Date]
     FROM [Price List]
    WHERE [From Date] between #3/1/2015# and date()
     UNION ALL SELECT [Item Description], [RetItmDte]
     FROM [RetItemItemDescription]
    WHERE [RetItmDte] between #3/1/2015# and date();

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    You could make a query on the union query to check the date...
    select * from qUnion with an extra field....
    iif([date]>#3/1/15#),[description],"")

  4. #4
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Thx Ajax & ranman256 it helped and solved the problem.

  5. #5
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Ajax What to add to get the final result by "Description" & "Item Description" in ascending order where as with the following am not getting the result by ascending order.


    SELECT [Description], [From Date]
    FROM [Price List]
    WHERE [From Date] between #3/1/2015# and date()
    UNION ALL SELECT [Item Description], [RetItmDte]
    FROM [RetItemItemDescription]
    WHERE [RetItmDte] between #3/1/2015# and date();

  6. #6
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    try

    Code:
    SELECT [Description], [From Date]
     FROM [Price List]
     WHERE [From Date] between #3/1/2015# and date()
     UNION ALL SELECT [Item Description], [RetItmDte]
     FROM [RetItemItemDescription]
     WHERE [RetItmDte] between #3/1/2015# and date()
    ORDER BY [Description], [From Date];

  7. #7
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Worked Like a Charm Thx

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

Similar Threads

  1. problem with union query with dateadd
    By manwe_sulimo in forum Queries
    Replies: 2
    Last Post: 01-25-2015, 12:35 PM
  2. excel to union query problem
    By gkaro in forum Access
    Replies: 2
    Last Post: 03-27-2014, 08:43 PM
  3. Relationship and Union Query Problem.
    By burrina in forum Access
    Replies: 4
    Last Post: 12-23-2012, 10:33 PM
  4. Replies: 1
    Last Post: 01-20-2012, 04:31 PM
  5. Union query problem
    By andreei87 in forum Queries
    Replies: 5
    Last Post: 05-09-2011, 09:39 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