|
-
May 10th, 2002, 10:15 AM
#1
Thread Starter
Hyperactive Member
Nearest quarter hour
Hi,
In the code below, LaborHours is a text box on the form.
Is there a better way to do this?
Code:
If LaborHours - Int(LaborHours) <> Abs(0) And _
LaborHours - Int(LaborHours) <> Abs(0.25) And _
LaborHours - Int(LaborHours) <> Abs(0.5) And _
LaborHours - Int(LaborHours) <> Abs(0.75) Then
MsgBox ("Labor Hours must be to the nearest 1/4 hour.")
End If
Thanks,
Al.
A computer is a tool, not a toy.
-
May 10th, 2002, 10:43 AM
#2
Fanatic Member
Hi,
One way could be....
VB Code:
Select Case Right$(Format$(LabourHours,"0.00"),2)
Case "00","25","50","75"
Msgbox "OK"
Case Else
Msgbox "Not to nearest 1/4 hour"
End Select
Although I'm sure there may be better solutions out there!! 
Blade
-
May 10th, 2002, 11:15 AM
#3
Frenzied Member
You could just mutiply the labour hours by 4 and check if its a whole number :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|