expression help

twistedsistem

Registered User.
Local time
Today, 10:14
Joined
Mar 8, 2007
Messages
10
I am trying to write an expression that will compare names in a field to see if they are the same. then as long as the name is the same i need a field to add another field and then subtract yet another field but if there is nothing in the subtract field then i just want the answer of the two added fields.
 
Start by using an If.. then statement.
If (Name1= Name2) then
total= Field1+field2 - Field3
else
Names not the same
end if
 
Thank you rainman and that would work but the names are already in the field and they are not being asked what name to compare i just have a some names that are duplicated because they have multiple rows that they need to be in and so i am wanting it to add it up for the multiple rows they are in.
 
im confused.
u want the names that are duplicates to be added and made into one record?

or just the total of the duplicates?

are these entries in your table already?
 
ok i have a query that runs and i am pulling pay periods and how many vacation hours someone has. now if you chose pay period 5 then that persons name is going to show up 5 times. so what i want to do is add up the hours for all five of those periods for each person and then create my totals that i had explained above.
 
you could do a query and in that query have a totalTime field. so have a total time field and do a calculation

totaltime=Sum(workHours) -Sum(vacationhours)

or however u want it then your query would look something like

Code:
SELECT Person, workHours, vacationhours From Table Where (Payperiod = [your txt field or listbox value for payperiod])

you could even group that by person adn just show total time

Thats how i would do it at least
 

Users who are viewing this thread

Back
Top Bottom