Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query two field dates where one not equals the other fill with last date

Status
Not open for further replies.

evr72

MIS
Dec 8, 2009
265
US
I have a query with two date fields date1 and date2, date1 always has more weeks than date2. date1 is the master file, sometimes I end up with something like this
Code:
date1    date2    dollars
week#    week#

44       44        $100
45       45        $150
46       46        $95
47                 $105
48                 $135

is there a way to perhaps make an extra field that would give me the last date on date2 or fill in the blanks with the last date it does not matter if the blanks in date2 repeat I have tried iif(date1<>date2,date2) and a couple of more like that but no luck always get the same ultimately I would like to see this

Code:
date1    date2    dollars
week#    week#

44       44        $100
45       45        $150
46       46        $95
47                 $105
48                 $135

Code:
or date1    date2    dollars
week#    week#

44       44        $100
45       45        $150
46       46        $95
47       46        $105
48       46        $135

or

Code:
date1    date2    dollars   Newdt
week#    week#

44       44        $100      46
45       45        $150      46
46       46        $95       46
47                 $105      46
48                 $135      46


any help pointing me in the right direcction or any suggestions is much appreciated and very welcomed!!
 
create a query
select
max(date2) as Maxdate2
from tablename


drag it into the query

change then field value of date2 to nz(date2,Maxdate2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top