PC Review


Reply
Thread Tools Rate Thread

Conditional Message Box

 
 
Jerry
Guest
Posts: n/a
 
      18th Feb 2009
I want to do a couple of things, first, compare data input in a text field
against a stored value. Second, if the values equal, display a message box,
if they don't equal display a different message box.

Can anyone point me in the right direction?

Thanks!
 
Reply With Quote
 
 
 
 
Pendragon
Guest
Posts: n/a
 
      18th Feb 2009
Customize by what your stored value is:

dim Resp as integer

Resp = InputBox("Enter 1 to display MsgBox 1 or enter 2 to display MsgBox 2")

if Resp = 1 then
MsgBox "You entered 1.", vbOKOnly (or whatever style you like)
else
MsgBox "You entered 2.", vbOKOnly
end if

This does not do anything for values other than those for which you
prompted; i.e., you will always get the second message box if the user enters
something other than 1. To modify...

if Resp = 1 then
MsgBox "You entered 1.", vbOKOnly (or whatever style you like)
elseif Resp = 2 then
MsgBox "You entered 2.", vbOKOnly
else
MsgBox "You did not enter a correct value.", vbOKOnly
end if

This latter set up is good if you are calling a function or setting forth a
process. If the user enters something other than 1 or 2, you can cancel
events, perform undos/clean-ups, etc.

To use in your scenario, rather than checking Resp against 1 or 2, you would
check the user's input against your stored value.

HTH.

Ross


"Jerry" wrote:

> I want to do a couple of things, first, compare data input in a text field
> against a stored value. Second, if the values equal, display a message box,
> if they don't equal display a different message box.
>
> Can anyone point me in the right direction?
>
> Thanks!

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: conditional message box EricG Microsoft Excel Programming 0 18th Jun 2009 04:08 PM
Re: Conditional Message Box strive4peace Microsoft Access Forms 2 23rd May 2008 04:06 PM
Conditional Message Box =?Utf-8?B?TGFEZEll?= Microsoft Excel Programming 3 21st May 2007 07:10 PM
Conditional Message Box =?Utf-8?B?RG9u?= Microsoft Access Form Coding 1 14th Nov 2004 12:28 PM
Conditional Message box ?? chimp Microsoft Excel Misc 2 17th Nov 2003 09:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:58 PM.