Time Format & Unload problem

  • Thread starter Thread starter Rod Taylor
  • Start date Start date
R

Rod Taylor

I have a Textbox that is used for a Time Input
I want the user to only be allowed to enter the info in the right format
I.a. 12:30 I think the part that is important is the : in the middle.

Also when the user clicks the command button An if statement is run to
verify that all fields have been filled in. If not then a msgbox comes up
stating that all info must be filled in.
The problem is when the msgbox is closed then the unload me is run and the
info that was put in is acted on
I fixed that by making all variables = "" However the form still closes
and needs to be run again.

Is their a way to allow the user to fill in the remaining boxes if the if
statement is true. Or is there another way

Thanks Rod Taylor
 
Rod,

If 'Verify that all fields have been filled in' then
'Act on your data
Unload Me
Else
Msgbox "Not all fields have been completed." & Chr(13) & _
Complete ALL fields and click the OK button again"
End If
End Sub

HTH
Henry
 
Someone asked for the code on the unload issue
If Leave_REQ = "" Or REQ_CONT_INT = "" Or AL_DMN = "" Or AL_ConTyp = "" Or
ST_Time = "" Or ET_Time = "" Then
MsgBox ("You must Fill in all INFO to make A Request")
Leave_REQ = "": ST_Time = "": ET_Time = "": REQ_CONT_INT = "": REQ_INFO
= ""
AWS = "": AL_DMN = "": SHFT = "": TODAY_TIME = "": FPE = "": AL_ConTyp = ""
End If


This is the if statment and it cleares all the info would rather not clear
the info but allow the user to fill in the required info.
 
Hello,

Set Cancel =True:
If Leave_REQ = "" Or REQ_CONT_INT = "" Or AL_DMN = "" Or AL_ConTyp =
"" Or
ST_Time = "" Or ET_Time = "" Then
MsgBox ("You must Fill in all INFO to make A Request")
Leave_REQ = "": ST_Time = "": ET_Time = "": REQ_CONT_INT = "":
REQ_INFO
= ""
AWS = "": AL_DMN = "": SHFT = "": TODAY_TIME = "": FPE = "": AL_ConTyp
= ""
Cancel=True
End If
Heiko
:-)
 
Rod,

As per my earlier post, this will check all the fields have an entry.
If so, it will do your actions and leave the sub.
If any of your fields are empty, it'll put up your messagebox.
When the user clicks OK on the message box, the message
box will go and will show the form as it was before the message box
appeared.
In other words, the user won't be able to leave the form until there is an
entry in
all of your fields.


If Leave_REQ <> "" And REQ_CONT_INT <> "" And AL_DMN <> "" _
and AL_ConTyp<> "" And ST_Time <> "" And ET_Time <> "" Then
'This checks that all of your fields have an entry (therefore, none are
empty)
'
'
'
' 'Act on your data here
'
'
'
Unload Me
'unload the form
'
'
Else
'At least one of your fields is empty
MsgBox ("You must Fill in all INFO to make A Request")
End If
End Sub
 
Back
Top