B
BoPeep
Because of problems that are caused if someone hits cancel on an input box, I
need to make it unavailable.
need to make it unavailable.
BoPeep said:I believe that will solve my problem once I get it properly entered. The
message box begins with a quantity of 0 and the message box only pops up if
the quantity is <1. When the cancel button is hit it removes the default
amount of 0 leaving the box empty, so the message box does not pop up again.
Here is my current code:
Private Sub Command5_Click()
Dim cust As String
If Forms!out.Mileage < 1 Then
Forms!out.Mileage = InputBox("We have no mileage for this work order",
"Please Enter Mileage", 0)
End If
cust = Forms!out.[Customer Name]
Forms!out.TOUT = Time()
'Forms!out.Note = Forms!out.Notes
Forms!out.IN = False
Forms!out.BILLABLE = Hour(Time()) - Hour(Forms!out.TIN) + (Minute(Time()) -
Minute(Forms!out.TIN)) / 60
DoCmd.Close acForm, "out"
DoCmd.Close acForm, "I-O"
MsgBox ("You have clocked out of the job for " & cust & " at " &
Format(Time(), "hh:mm"))
End Sub
Would I insert your code after the End If statement? My son wrote this
program for me while he was still in high school. Now his is out on his on
with no internet access and it's sometime hard for him to walk me thru stuff
over the phone. I can do a fair amount of stuff in Access, but am very
limited on my visual basic knowledge. Thanks!
Terry Kreft said:You can't do that unless you roll your own form, what you can do is refuse
to accept the cancel and diplay the inputnbox again.
e.g. Put he following into a module
Function InputBox(Prompt, Optional Title, Optional Default, Optional XPos,
Optional YPos, Optional HelpFile, Optional Context) As String
Dim strRet As String
Do While strRet = vbNullString
strRet = VBA.InputBox(Prompt, Title, Default, XPos, YPos, HelpFile,
Context)
Loop
InputBox = strRet
End Function
Any code you have now which calls the InputBox function should just work.
BoPeep said:I believe that will solve my problem once I get it properly entered. The
message box begins with a quantity of 0 and the message box only pops up if
the quantity is <1. When the cancel button is hit it removes the default
amount of 0 leaving the box empty, so the message box does not pop up again.
Here is my current code:
Private Sub Command5_Click()
Dim cust As String
If Forms!out.Mileage < 1 Then
Forms!out.Mileage = InputBox("We have no mileage for this work order",
"Please Enter Mileage", 0)
End If
cust = Forms!out.[Customer Name]
Forms!out.TOUT = Time()
'Forms!out.Note = Forms!out.Notes
Forms!out.IN = False
Forms!out.BILLABLE = Hour(Time()) - Hour(Forms!out.TIN) + (Minute(Time()) -
Minute(Forms!out.TIN)) / 60
DoCmd.Close acForm, "out"
DoCmd.Close acForm, "I-O"
MsgBox ("You have clocked out of the job for " & cust & " at " &
Format(Time(), "hh:mm"))
End Sub
Would I insert your code after the End If statement? My son wrote this
program for me while he was still in high school. Now his is out on his on
with no internet access and it's sometime hard for him to walk me thru stuff
over the phone. I can do a fair amount of stuff in Access, but am very
limited on my visual basic knowledge. Thanks!
Terry Kreft said:You can't do that unless you roll your own form, what you can do is refuse
to accept the cancel and diplay the inputnbox again.
e.g. Put he following into a module
Function InputBox(Prompt, Optional Title, Optional Default, Optional XPos,
Optional YPos, Optional HelpFile, Optional Context) As String
Dim strRet As String
Do While strRet = vbNullString
strRet = VBA.InputBox(Prompt, Title, Default, XPos, YPos, HelpFile,
Context)
Loop
InputBox = strRet
End Function
Any code you have now which calls the InputBox function should just work.
BoPeep said:I believe that will solve my problem once I get it properly entered. The
message box begins with a quantity of 0 and the message box only pops up if
the quantity is <1. When the cancel button is hit it removes the default
amount of 0 leaving the box empty, so the message box does not pop up again.
Here is my current code:
Private Sub Command5_Click()
Dim cust As String
If Forms!out.Mileage < 1 Then
Forms!out.Mileage = InputBox("We have no mileage for this work order",
"Please Enter Mileage", 0)
End If
cust = Forms!out.[Customer Name]
Forms!out.TOUT = Time()
'Forms!out.Note = Forms!out.Notes
Forms!out.IN = False
Forms!out.BILLABLE = Hour(Time()) - Hour(Forms!out.TIN) + (Minute(Time()) -
Minute(Forms!out.TIN)) / 60
DoCmd.Close acForm, "out"
DoCmd.Close acForm, "I-O"
MsgBox ("You have clocked out of the job for " & cust & " at " &
Format(Time(), "hh:mm"))
End Sub
Would I insert your code after the End If statement? My son wrote this
program for me while he was still in high school. Now his is out on his on
with no internet access and it's sometime hard for him to walk me thru stuff
over the phone. I can do a fair amount of stuff in Access, but am very
limited on my visual basic knowledge. Thanks!
Terry Kreft said:You can't do that unless you roll your own form, what you can do is refuse
to accept the cancel and diplay the inputnbox again.
e.g. Put he following into a module
Function InputBox(Prompt, Optional Title, Optional Default, Optional XPos,
Optional YPos, Optional HelpFile, Optional Context) As String
Dim strRet As String
Do While strRet = vbNullString
strRet = VBA.InputBox(Prompt, Title, Default, XPos, YPos, HelpFile,
Context)
Loop
InputBox = strRet
End Function
Any code you have now which calls the InputBox function should just work.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.