Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2009
    Posts
    4

    Query two different records in the same table

    I need to Query two different dates in the same table. One of the fields is called Today and the other is Rev_date. I want to be able to enter just one set of dates for beginning range and end range and have it bring up records that match both of the fields dates. Hope that makes sense. Any idea on how to do it?

  2. #2
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150
    no so clear for me. where are you going to put your beginning range and ending range criteria? I am just wondering how in the world you have two date fields and how you input into them and wanting to bring matched records between them?

    anyway, you can make two queries: one for TODAY field only and another query for REV_DATE only. then you can create your third query. the third query recordsource will be the TODAY query and REV_DATE query. just join the TODAY and REV_DATE fields so you will have match records for both fields.

    with regards to entering one set of date, you can make one form which you can name "form1" which has two fields named: begdate and enddate. also has one commandbutton which you can name "ok"

    on your query today and query rev_date, set the criteria to BETWEEN forms!form1!begdate and forms!form1!enddate

    then on On_Click event of your "ok" commandbutton:

    private sub Ok_click()
    DoCmd.OpenQuery "nameofthirdquery", acViewNormal, acReadOnly
    docmd.Close acForm,"form1",acSaveNo
    END SUB

    the above code is just a simple coding but it should work for that purpose.

    let me know what happens!

  3. #3
    Join Date
    Apr 2009
    Posts
    4
    the Today field is the day it was entered in the DB and the Rev_date is the most recent day the record was updated. So i need the query to pull records with matching today fields within a range as well as the Rev_dates within the same date range. Right now i am just using the between command in the today field and if do the same for the rev_date field i have to enter in the same date twice, which i am trying to avoid.

  4. #4
    marianne is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Asia Pacific Region
    Posts
    150
    you dont need to enter the date twice. check my advice on making a FORM on my first reply. that should do it.

  5. #5
    Join Date
    Apr 2009
    Posts
    4
    going to try that when i get to work thanks a lot for the help. I took some access classes while getting my degree but didn't use it and forgot most of it haha. Now getting thrown back into it at work so really appreciate the help.

  6. #6
    Join Date
    Apr 2009
    Posts
    4
    Went through and did every in your first post but it isn't returning any dates at all. anything i should post to see about debugging?
    Last edited by Eildydar; 04-15-2009 at 04:39 PM.

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

Similar Threads

  1. Inserting multiple records into a table
    By New2Access in forum Programming
    Replies: 1
    Last Post: 07-07-2011, 09:18 PM
  2. Replies: 1
    Last Post: 01-31-2009, 10:43 AM
  3. Delete all records in a table?
    By bob646 in forum Access
    Replies: 1
    Last Post: 05-20-2007, 11:41 PM
  4. Creating a string from all records in a table
    By ocordero in forum Programming
    Replies: 2
    Last Post: 08-07-2006, 09:21 AM
  5. Replies: 1
    Last Post: 03-17-2006, 12:04 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