I don't know if this is really what you're looking for and there probably
is a better way of coding it, but I had such a fun time trying to find a
solution that I had to write it down.
Here goes!
I think you're better of with a field in your table that isn't a Date/Time
one, since you want to store the AMOUNT of hours/minutes and not the time.
So I suggest using the 'Number' DataType for this one.
Go to the table and make a Field with these properties:
- FieldSize: Single
- DecimalPlaces: 2
- ValidationRule: Between 0 And 23.99
Now open your form in desing mode. Select the textfield that will be used
to type the amount of hours. Make sure it doesn't use a predefined format.
Then add a AfterUpdate event like this one:
Private Sub [your textfield name]_AfterUpdate()
Dim number, number2
number = Int(Me.[your textfield name])
number2 = Me.[your textfield name]- number
Select Case number2
Case 0 To 0.125
Me.[your textfield name] = Me.[your textfield name] - number2
Case 0.126 To 0.365
Me.[your textfield name] = Me.[your textfield name] - (number2 - 0.25)
Case 0.366 To 0.625
Me.[your textfield name] = Me.[your textfield name] - (number2 - 0.5)
Case 0.626 To 0.885
Me.[your textfield name] = Me.[your textfield name] - (number2 - 0.75)
Case 0.896 To 1
Me.[your textfield name] = Me.[your textfield name] - (number2 - 1)
End Select
End Sub
Don't forget to replace the [your textfield name] when copying the code
Hope this works for you and again: this is probably a quite rudimentary
solution, but it's as far as my VB skills go.
Later,
Philo