A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Update Query for Fiscal Date range



 
 
Thread Tools Display Modes
  #1  
Old July 17th, 2008, 03:46 PM posted to microsoft.public.access.queries
workweek
external usenet poster
 
Posts: 3
Default Update Query for Fiscal Date range

I have one table that contains Today's Date. I have a second table that
contains fiscal month dates. For example July = 6/28/2008 - 8/01/2008. I
need to populate a third table with the fiscal month beginning date and end
date based on today's date. For example today's date = 7/17/2008; I need to
populate the 3rd table with beginning date field = 6/28/2008 and ending date
field = 8/01/2008. What logic do I use to write this?
  #2  
Old July 17th, 2008, 05:01 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 2,364
Default Update Query for Fiscal Date range



SELECT FiscalStart, FiscalEnd
FROM FiscalTable
WHERE FiscalStart = Date() and FiscalEnd = Date()

Expanding on that to do for multiple dates

SELECT FiscalStart, FiscalEnd
FROM FiscalTable, DatesTable
WHERE FiscalStart = DatesTable.SomeDate
AND FiscalEnd = DatesTable.SomeDate

OR

SELECT FiscalStart, FiscalEnd
FROM FiscalTable INNER JOIN DatesTable
ON FiscalTable.FiscalStart = DatesTable.SomeDate
AND FiscalTable.FiscalEnd = DatesTable.SomeDate



'================================================= ===
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'================================================= ===


workweek wrote:
I have one table that contains Today's Date. I have a second table that
contains fiscal month dates. For example July = 6/28/2008 - 8/01/2008. I
need to populate a third table with the fiscal month beginning date and end
date based on today's date. For example today's date = 7/17/2008; I need to
populate the 3rd table with beginning date field = 6/28/2008 and ending date
field = 8/01/2008. What logic do I use to write this?

  #3  
Old July 17th, 2008, 06:19 PM posted to microsoft.public.access.queries
John W. Vinson/MVP
external usenet poster
 
Posts: 325
Default Update Query for Fiscal Date range

On Thu, 17 Jul 2008 07:46:02 -0700, workweek
wrote:

I have one table that contains Today's Date. I have a second table that
contains fiscal month dates. For example July = 6/28/2008 - 8/01/2008. I
need to populate a third table with the fiscal month beginning date and end
date based on today's date. For example today's date = 7/17/2008; I need to
populate the 3rd table with beginning date field = 6/28/2008 and ending date
field = 8/01/2008. What logic do I use to write this?


What's the actual structure of your fiscal dates table? It would be
simplest if it had four fields: FYear, FMonth, StartDate and EndDate,
with values 2008, 7 (or "July" if you prefer), #6/28/2008# and
#8/1/2008#. Also, why do you have a *TABLE* for today's date? You can
read it directly from your compter calendar using the Date() function.

You can run an Append query from my suggested date range table to
insert a record into the third table. Just use a criterion on
StartDate of = Date(), and on EndDate of = Date(). Change the query
to an Append query and append a record.

--

John W. Vinson/MVP
 




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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.