G
Guest
Sorry if this question has been asked before, but I did a search and I didn't
find anything.
In any case, I have a command button on my form that opens an InputBox in
order to prompt the user for input. On the InputBox are two buttons, "Ok"
and "Cancel." I would like to exit the procedure when a user clicks the
Cancel button, but my code is not working.
I tried the same code using a MsgBox and specifying the buttons as
vbOkCancel and it exited the procedure correctly, but for some reason it
doesn't seem to work with an InputBox.
Dim Record As String
Dim Message As String
Dim Response
Message = "What field would you like to count?"
Response = InputBox(Message)
If Response = vbCancel Then
Exit Sub
Else: Record = Response
End If
If someone could offer a suggestion as to how to get it to exit the
procedure I would appreciate it.
Thanks,
Chris
find anything.
In any case, I have a command button on my form that opens an InputBox in
order to prompt the user for input. On the InputBox are two buttons, "Ok"
and "Cancel." I would like to exit the procedure when a user clicks the
Cancel button, but my code is not working.
I tried the same code using a MsgBox and specifying the buttons as
vbOkCancel and it exited the procedure correctly, but for some reason it
doesn't seem to work with an InputBox.
Dim Record As String
Dim Message As String
Dim Response
Message = "What field would you like to count?"
Response = InputBox(Message)
If Response = vbCancel Then
Exit Sub
Else: Record = Response
End If
If someone could offer a suggestion as to how to get it to exit the
procedure I would appreciate it.
Thanks,
Chris