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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MONTHLY TOTALS - STUPID QUESTION!

Status
Not open for further replies.

Angelique

Technical User
Mar 9, 2001
127
AU
My main table contains a date field e.g. 01/07/01 for record for the entire year. How do you create monthly totals in Paradox? Does Paradox have a Month function like Access?

Any advice would be nice.

Angelique
 
IF your dates are actually values in a record, then do a query for a date range. e.g:

method run (var eventInfo eventInfo)

Var
Q1 Query
dateMin, dateMax Date
endVar

dateMin = Date("6/1/01")
dateMav = Date("7/1/01")

Q1 = Query
:pRIV:ANSWER.DB

myTable.db | dateField | Totals |
| >~dateMin, <~dateMax | calc sum |


endQuery

executeQBE(Q1)

endMethod

If the date values are field names (I use these for annual sales files) then you can find the field number of the week you are looking for, then use the range of fields to calculate a sum for the month. I think you have the first case, so I won't go into this unless you need it. Let us know.


 
IF your dates are actually values in a record, then do a query for a date range. e.g:

method run (var eventInfo eventInfo)

Var
Q1 Query
dateMin, dateMax Date
endVar

dateMin = Date(&quot;5/30/01&quot;)
dateMav = Date(&quot;7/1/01&quot;)

Q1 = Query
:pRIV:ANSWER.DB

myTable.db | dateField | Totals |
| >~dateMin, <~dateMax | calc sum |


endQuery

executeQBE(Q1)

endMethod

If the date values are field names (I use these for annual sales files) then you can find the field number of the week you are looking for, then use the range of fields to calculate a sum for the month. I think you have the first case, so I won't go into this unless you need it. Let us know.


 
Thanks,

I will give it a go and let you know.


Angelique
 
If you want a range of dates, then set up a table with a structure like

Sort N*
Name A10
StartDate D
EndDate D

Sort will keep things in the right order!
Name will be like Jan01, Feb01 etc.
StartDate will be 1.1.2001, 1.2.2001
EndDate will be 1.2.2001, 1.3.2001
(end is the first of the following month, so you do not have to remember the number of days in each month, look for less than this date).

then link in the query to this table with

Date in data table >=_start, <_end

and in the range table

StartDate = _start
EndDate = _date

You can then do you calc sum for many months in one go.

Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top