G
Guest
i am trying to setup a couple of msgbox routines to check on 2 different items.
ITEM 1
- using the following text boxes on form [Input Data form].
[Uptime] [Downtime]
I am using the following code (in the Downtime_lostfocus event) to determine
if the msgbox should work or not
Dim dblDownTime As Double
Dim dblUpTime As Double
Dim dblTotalTime As Double
dblUpTime = UpTime
dblDownTime = DownTime
dblTotalTime = dblUpTime + dblDownTime
If dblTotalTime > 8 Then
MsgBox "The total hours of uptime and downtime " & Chr(13) & _
" cannot exceed 8 hours.", vbOKOnly + vbCritical
DownTime.SetFocus
End If
currently i can get the msgbox to pop up, but i want the focus to return to
downtime box after user hits the ok button. right now it just moves on to the
next box.
Item 2
- using the following text boxes on form [Input Data form].
[Defect1_Quantity] [Defect2_Quantity] [Defect3_Quantity] [Other]
[txtTotalDefects] - is a sum of the previous 4 textboxes that updates on
each of the previous four text box's lost_focus() event.
[ScrapPercentage] - has the following code as the Data Control Source.
=IIf([totalpartsran]=0,0,(([txttotaldefects]/[totalpartsran])*100))
[txtComments]
I am trying to use the following for getting a message box to pop up to let
the user know they need to fill in the [txtComments] box on the same form,
then send the focus to the [txtComments] box.
If ScrapPercentage > 2 And txtComments = "" Then
MsgBox "You have a Scrap Percentage greater than 2. " & Chr$(13) & _
"Please add a Comment to the Comment box.", vbOKOnly
txtComments.SetFocus
End If
i've tried to use the previous code in the [ScrapPercentage] box's
afterupdate event, and on each of the defect#_quantity boxes lostfocus
events, as well as the add record command button's gotfocus event.
any help with either of these items would be appreciated. thanks.
ITEM 1
- using the following text boxes on form [Input Data form].
[Uptime] [Downtime]
I am using the following code (in the Downtime_lostfocus event) to determine
if the msgbox should work or not
Dim dblDownTime As Double
Dim dblUpTime As Double
Dim dblTotalTime As Double
dblUpTime = UpTime
dblDownTime = DownTime
dblTotalTime = dblUpTime + dblDownTime
If dblTotalTime > 8 Then
MsgBox "The total hours of uptime and downtime " & Chr(13) & _
" cannot exceed 8 hours.", vbOKOnly + vbCritical
DownTime.SetFocus
End If
currently i can get the msgbox to pop up, but i want the focus to return to
downtime box after user hits the ok button. right now it just moves on to the
next box.
Item 2
- using the following text boxes on form [Input Data form].
[Defect1_Quantity] [Defect2_Quantity] [Defect3_Quantity] [Other]
[txtTotalDefects] - is a sum of the previous 4 textboxes that updates on
each of the previous four text box's lost_focus() event.
[ScrapPercentage] - has the following code as the Data Control Source.
=IIf([totalpartsran]=0,0,(([txttotaldefects]/[totalpartsran])*100))
[txtComments]
I am trying to use the following for getting a message box to pop up to let
the user know they need to fill in the [txtComments] box on the same form,
then send the focus to the [txtComments] box.
If ScrapPercentage > 2 And txtComments = "" Then
MsgBox "You have a Scrap Percentage greater than 2. " & Chr$(13) & _
"Please add a Comment to the Comment box.", vbOKOnly
txtComments.SetFocus
End If
i've tried to use the previous code in the [ScrapPercentage] box's
afterupdate event, and on each of the defect#_quantity boxes lostfocus
events, as well as the add record command button's gotfocus event.
any help with either of these items would be appreciated. thanks.