check this out and help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: check this out and help

  1. #1
    JM Thomas Guest

    check this out and help


    I am making a comparaison between two cells in a form

    why do I get an error if the first digit sBaseSalarylow is greater sBaseSalaryHigh
    even when the value of the low is smaller than the high


    example

    50,000 Low
    100,000 high


    5>1
    Can anyone help I do not have my reference book with me.


    if sBaseSalarylow > sBaseSalaryHigh then
    document.all("salaryl").style.color="red"

    ErrorExit = True
    else
    document.all("salaryl").style.color="black"

    end if

    Share on Google+

  2. #2
    Carl Ray Guest

    Re: check this out and help


    Looks like your Base Salary variables are character strings since they have
    the "s" prefix. Since they're seen as text, they're being compared by which
    one comes first alphabetically. Since 5 comes after 1, the string "50,000"
    is seen as greater. Use the CCur conversion function to change the salaries
    to Currency (i.e., "CCur(sBaseSalarylow) > CCur(sBaseSalaryHigh)") and it
    should work.

    Hope that helps,

    Carl

    "JM Thomas" <sakpasse1@hotmail.com> wrote:
    >
    > I am making a comparaison between two cells in a form
    >
    >why do I get an error if the first digit sBaseSalarylow is greater sBaseSalaryHigh
    >even when the value of the low is smaller than the high
    >
    >
    >example
    >
    >50,000 Low
    >100,000 high
    >
    >
    >5>1
    >Can anyone help I do not have my reference book with me.
    >
    >
    >if sBaseSalarylow > sBaseSalaryHigh then
    > document.all("salaryl").style.color="red"
    >
    >ErrorExit = True
    >else
    > document.all("salaryl").style.color="black"
    >
    >end if
    >


    Share on Google+

  3. #3
    JM Thomas Guest

    Re: check this out and help


    Thanks
    It works
    What Book would you recommend for VBScript I am still in a learning Stage.


    "Carl Ray" <carlray@vbnexus.com> wrote:
    >
    >Looks like your Base Salary variables are character strings since they have
    >the "s" prefix. Since they're seen as text, they're being compared by which
    >one comes first alphabetically. Since 5 comes after 1, the string "50,000"
    >is seen as greater. Use the CCur conversion function to change the salaries
    >to Currency (i.e., "CCur(sBaseSalarylow) > CCur(sBaseSalaryHigh)") and it
    >should work.
    >
    >Hope that helps,
    >
    >Carl
    >
    >"JM Thomas" <sakpasse1@hotmail.com> wrote:
    >>
    >> I am making a comparaison between two cells in a form
    >>
    >>why do I get an error if the first digit sBaseSalarylow is greater sBaseSalaryHigh
    >>even when the value of the low is smaller than the high
    >>
    >>
    >>example
    >>
    >>50,000 Low
    >>100,000 high
    >>
    >>
    >>5>1
    >>Can anyone help I do not have my reference book with me.
    >>
    >>
    >>if sBaseSalarylow > sBaseSalaryHigh then
    >> document.all("salaryl").style.color="red"
    >>
    >>ErrorExit = True
    >>else
    >> document.all("salaryl").style.color="black"
    >>
    >>end if
    >>

    >


    Share on Google+

  4. #4
    Carl Ray Guest

    Re: check this out and help


    There's actually several good ones out there. The one that a lot of people
    seem to like is an O'Reilly book called "Learning VBScript" by Paul Lomax.
    If you are just looking for a desktop reference, there's one by Wrox called
    "VBScript Programmer's Reference".

    Carl
    carlray@vbnexus.com

    "JM Thomas" <sakpasse1@yaoo.com> wrote:
    >
    >Thanks
    >It works
    >What Book would you recommend for VBScript I am still in a learning Stage.
    >
    >
    >"Carl Ray" <carlray@vbnexus.com> wrote:
    >>
    >>Looks like your Base Salary variables are character strings since they

    have
    >>the "s" prefix. Since they're seen as text, they're being compared by

    which
    >>one comes first alphabetically. Since 5 comes after 1, the string "50,000"
    >>is seen as greater. Use the CCur conversion function to change the salaries
    >>to Currency (i.e., "CCur(sBaseSalarylow) > CCur(sBaseSalaryHigh)") and

    it
    >>should work.
    >>
    >>Hope that helps,
    >>
    >>Carl
    >>
    >>"JM Thomas" <sakpasse1@hotmail.com> wrote:
    >>>
    >>> I am making a comparaison between two cells in a form
    >>>
    >>>why do I get an error if the first digit sBaseSalarylow is greater sBaseSalaryHigh
    >>>even when the value of the low is smaller than the high
    >>>
    >>>
    >>>example
    >>>
    >>>50,000 Low
    >>>100,000 high
    >>>
    >>>
    >>>5>1
    >>>Can anyone help I do not have my reference book with me.
    >>>
    >>>
    >>>if sBaseSalarylow > sBaseSalaryHigh then
    >>> document.all("salaryl").style.color="red"
    >>>
    >>>ErrorExit = True
    >>>else
    >>> document.all("salaryl").style.color="black"
    >>>
    >>>end if
    >>>

    >>

    >


    Share on Google+

  5. #5
    Phil Weber Guest

    Re: check this out and help

    JM: I see you've received answers to your questions, but for future
    reference, you're more likely to get help with VBScript questions if you
    post them to the web.dhtml.scripting newsgroup. As its name implies, this
    group is for announcements, not technical discussions. Thanks!
    ---
    Phil Weber
    DevX Newsgroup Admin


    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center