Re: exception to MsgBox

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You asked a specific question and got a specific answer. It the choices are
not "A" "B" or "C", then the answer isn't appropriate

If the choices are actually three text strings of multiple characters than
checking for a len of 1 is inappropriate.

Dim s as String
s = "#" & Trim(Me.cboDealer.Value) & "#"
if instr(1,"#AAAAA#BBBBB#CCCCC#", _
s,vbTextCompare)>0 then
If Trim(Me.txtPO.Value) = "" Then
Me.txtPO.SetFocus
MsgBox "Please enter a Purchase Order Number."
Exit Sub
End If
End if

Replace AAAAA, BBBBB, and CCCCC with your text strings.

--
Regards,
Tom Ogilvy




"L Scholes" <pwpd406@xxxxxxxxxxxxx> wrote in message
news:1144978523.725700.27540@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In your code you have "ABC" on line 3. When I substitute for my list,
should I include the names without spaces or commas within one set of
quotes, or list each separately in their own quotes, separated by
commas?



.



Relevant Pages

  • Re: VBA output to text editor
    ... You specify your position in the ... <filenumber> is the number of the open file. ... If you had 3 strings that made up an ... back correctly because the strings will have double quotes around it. ...
    (microsoft.public.excel.programming)
  • [opensuse] Re: apache mod_rewrite
    ... outside of quotes and inside double-quote strings but not inside ... single-quote strings. ... based on the intention of it being included in that command, ... If you want to insist that my read of this is incorrect, ...
    (SuSE)
  • Re: Cant pass "[System.IO.FileMode]::Open" as a Constructor argument of "FileStream"
    ... you need to use quotes if the argument is going to contain any ... > doesn't this make it very hard to resolve to the correct member overload? ... Agreed - expression mode let's you be very explicit. ... >> these argument strings and converts them into the necessary target ...
    (microsoft.public.windows.server.scripting)
  • Re: AWK does a proper replace but whipes out other characters
    ... > enclosed in double quotes, ... > strings have commas inside them and that ruins my processing since I ... > pick out tokens based on the separator i.e. comma. ...
    (comp.unix.shell)
  • Re: Import data into seperate columns
    ... In Excel 2000, it doesn't "respect" the commas. ... Excel will respect those strings within double quotes. ...
    (microsoft.public.excel.misc)