How to show current vacation time

Brian62

Registered User.
Local time
Today, 16:45
Joined
Oct 20, 2008
Messages
159
I have a form I am trying to show the vacation time used.

The table name is Timeoff, columns are: "Code" (shows Vacation and illness) and "Timeused" (Hrs used for vacation, example 8 hrs for the day)

I would like to add the "Timeused" (8 hrs) that has the "code" (Vacation) to show in the unbound text box.

=Sum(IIf(
Code:
)=[Vacation],[timeused],Null))
also tried
=Sum(IIf([timeoff].[code]=[vacation],[timeused],0))
 
This is what I came up with, but I can't get it to work, gives me an #error. Any suggestions? Thx!
 
I would really like to add the total hours the employee gets bi-weekly and subtract from the timeused that was used for vacation to give what they have left.
 
Vacation is a String, [Code] is obviously defined as a Text Field, and so Vacation has to have Quotation Marks around it.

Also, you have and extra right-hand parenthesis directly after
Code:
[/B].  So try

[B]=Sum(IIf([code]= "Vacation",[timeused],Null))[/B]

and see if it works as expected.

BTW, [B]Square Brackets[/B] are used around [B]Field names[/B] and around [B]Control names[/B] (if they contain spaces, which they really shouldn't.) They [B]are not used[/B] around the [B]Values[/B] of [B]Controls[/B], such as [[B]Vacation[/B]].

Linq [B];0)>[/B]
 
I tried that one as well and it did not work. Still giving me #error.
I also tried this one: =Sum(IIf([timeoff].
Code:
="Vacation",[timeused],Null))
Timeoff is the table name and code & timeused is the column name.
 
It worked in Query but trying to get it to work in the form in an unbound text box.
 
Thanks!
 
I have added my db which is a very simple one except for the code. I hope this helps.
 

Attachments

I don't run Access 2007/2010 and so can't open your file. Sum() has to be run against the Textboxes holding the data, not agaisnt the Field names. Sometimes having the Field and the Textbox named the same thing can cause problems. And, of course, Access names the Texboxes the same as the Fields. If this is the situation, change the name of the Textbox and change your Sum() to use the Textbox name and see what happens.
 

Users who are viewing this thread

Back
Top Bottom