Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Access

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 04-14-2009, 02:05 PM
Novice
 
Join Date: Apr 2009
Posts: 4
Eildydar is on a distinguished road
Default 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?
Reply With Quote
  #2  
Old 04-14-2009, 07:07 PM
marianne marianne is offline Windows XP Access 2003 (version 11.0)
Competent Performer
 
Join Date: Mar 2009
Location: Asia Pacific Region
Posts: 151
marianne is on a distinguished road
Default

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!
Reply With Quote
  #3  
Old 04-14-2009, 07:51 PM
Novice
 
Join Date: Apr 2009
Posts: 4
Eildydar is on a distinguished road
Default

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.
Reply With Quote
  #4  
Old 04-14-2009, 11:31 PM
marianne marianne is offline Windows XP Access 2003 (version 11.0)
Competent Performer
 
Join Date: Mar 2009
Location: Asia Pacific Region
Posts: 151
marianne is on a distinguished road
Default

you dont need to enter the date twice. check my advice on making a FORM on my first reply. that should do it.
Reply With Quote
  #5  
Old 04-15-2009, 08:09 AM
Novice
 
Join Date: Apr 2009
Posts: 4
Eildydar is on a distinguished road
Default

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.
Reply With Quote
  #6  
Old 04-15-2009, 11:39 AM
Novice
 
Join Date: Apr 2009
Posts: 4
Eildydar is on a distinguished road
Default

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 02:39 PM.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help creating a sequential number for records in a table or query rthomas Access 1 01-31-2009 07:43 AM
Delete all records in a table? bob646 Access 1 05-20-2007 09:41 PM
Inserting multiple records into a table New2Access Programming 0 02-18-2007 09:46 PM
Creating a string from all records in a table ocordero Programming 2 08-07-2006 07:21 AM
Selecting and modifying records in a table Ed H Access 1 03-17-2006 09:04 AM


All times are GMT -8. The time now is 02:48 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.