I assume that's an error in your example: that what's left as vacation
should be Vacation: 5-days, 4-hours, 0-minutes, not 6-days, 4-hours,
0-minutes.
What do your tables look like? Hopefully Vacation, Personal and Compt aren't
stored as day, hours, minutes, but strictly total minutes. (Also, hopefully
they aren't 3 separate fields in the same table)
In essence, you're going to have to use VBA to figure out what to do.
Assuming what you used is stored in a variable lngUsed, you need something
like the following pseudocode:
If Compt >= lngUsed Then
Compt = Compt - lngUsed
lngUsed = 0
Else
lngUsed = lngUsed - Compt
Compt = 0
If Personal >= lngUsed Then
Personal = Personal - lngUsed
lngUsed = 0
Else
lngUsed = lngUsed - Personal
Person = 0
If Vacation >= lngUsed Then
Vacation = Vacation - lngUsed
lngUsed = 0
Else
lngUsed = lngUsed - Vacation
Vacation = 0
End If
End If
End If
If lngUsed > 0 Then
MsgBox "Not everything could be allocated"
End If
That's about the best I can do without knowing more about your setup.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"RMCDD997" <(E-Mail Removed)> wrote in message
news:045A779B-DF71-4F09-92AA-(E-Mail Removed)...
> Thanks for responding Douglas, I appreciate your assistance. Maybe this
> will
> help. Example: I currently have
> Vacation: 5-days, 6-hours, 0-minutes
> Personal: 0-days, 2-hours, 0-minutes
> Compt: 0-days, 2-hours, 0-mintues
>
> I use 6 hours - which shoud be deducted from compt, personal, then
> vacation
> leaving the balance of:
> Vacation: 6-days, 4-hours, 0-minutes
> Personal: 0-days, 0-hours, 0-minutes
> Compt: 0-days, 0-hours, 0-mintues
> Thanks Again
>
> "Douglas J. Steele" wrote:
>
>> A1
>>
>> Function FormatMinutes(TotalMinutes As Long) As String
>>
>> Dim lngDays As Long
>> Dim lngHours As Long
>> Dim lngHoursAndMinutes As Long
>>
>> lngDays = TotalMinutes \ 480
>> lngHoursAndMinutes = TotalMinutes Mod 480
>> lngHours = lngHoursAndMinutes \ 60
>>
>> FormatMinutes = lngDays & "-Days, " & _
>> lngHours & "-Hours, " & _
>> lngHoursAndMinutes - (lngHours * 60) & "-minutes"
>>
>> End Function
>>
>> A2
>>
>> Afraid I don't understand the question. Can you give an example to
>> clarify
>> what you mean?
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no private e-mails, please)
>>
>>
>> "RMCDD997" <(E-Mail Removed)> wrote in message
>> news:9F8E4501-2AFF-433A-A5C7-(E-Mail Removed)...
>> >I would like to create my own vacation db. 1 day = 8 hours. I want to
>> >track
>> > my Vacation Time, Compt Time & Personal Time. Each displays the total
>> > minutes
>> > I have available. Minutes are my smallest unit of measurement.
>> > Q1 - How do I take my total minutes (25320.0) and display it as:
>> > 52-days,
>> > 6-hours, 0-minutes?
>> > Q2 - Time used is subtracted in this order: from Compt Time, Personal
>> > time, then Vacation time. How would this be set up.
>> >
>> > Thanks again for all you.
>>
>>
>>