percent

P

Perplexed

Heres my table

AccountName X00000
SSN 111111111
Name Joe Smith
JuneGrossSalary $4589.25
MayGrossSalary $4348.67

What i need to do is Find out if the difference between JuneGross and
MayGross is more than 35% and if it is then i need it to output something
like "Check" if not then no action

Thanks
 
W

Wayne Morgan

To start with, you need more than one table. Keep the AccountName, SSN, and
Name (not a good field name, it's a reserved word) in one table. There
should be a unique ID field in this table also. The AccountName may be able
to suffice for this. Create another table for Salary. You need a unique ID
field for this table, a field for the Unique ID field from the current table
(to link the two tables), a date field showing the date the salary was paid,
and an amount field for the amount paid. You would then be able to sum up
the salary for each month by querying this table and compare two months as
well.

Example:
'This assumes AccountName to be the UniqueID field
curFirstMonth = DSum("SalaryPaid", "tblSalary", "AccountName=""" &
Me.txtAccountName & """ And Format([DatePaid], ""mmyyyy"")=""052005"")
curSecondMonth = DSum("SalaryPaid", "tblSalary", "AccountName=""" &
Me.txtAccountName & """ And Format([DatePaid], ""mmyyyy"")=""062005"")
'This will give the decimal value of the percent
'i.e. 0.35 is 35%
curPercentIncrease = (curSecondMonth - curFirstMonth) / curFirstMonth

You could have an option on the form to input which two months you want to
compare and have it set the value where there is currently "052005" and
"062005".
 
Top