Link to home
Start Free TrialLog in
Avatar of Evert Jor
Evert JorFlag for Norway

asked on

Need help to rewrite script

I have this script:
sub pddinstock()
      if useStockManagement AND showinstock=TRUE then if cint(rs("pStockByOpts"))=0 then print "<div class=""prodinstock detailinstock""><strong>" & xxInStoc & ":</strong> " & vrmax(0,rs("pInStock")) & "</div>"
end sub

I need to change it so that " & vrmax(0,rs("pInStock")) & " returns an output like "Few items left."  instead of the " & vrmax(0,rs("pInStock")) & " value when the value of " & vrmax(0,rs("pInStock")) & " is less than 5 and when the value of " & vrmax(0,rs("pInStock")) & " is more than 5 it should say "In stock."

I have tried to rewrite the script, but as I'm doing it in Notepad I have to test it after each modification and I have still not figured it out. Now I've been at it for a few hours. Anyone know how to rewrite it?

Many thanks in advance.

Best regards,
Evert
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Could you explain your variables?

It looks smt like
sub pddinstock()
       if useStockManagement AND showinstock=TRUE then
            if cint(rs("pStockByOpts"))=0 then
                 'does this means there is stock available
                  if xxInStock < 5 then msgbox "your message"  else msgbox "your second message"
            end if
       end if
       
 end sub
Avatar of Evert Jor

ASKER

Excellent solution.