need help with parameters 
Author Message
 need help with parameters

this vb script works, but when i try to use parameters, nothing is
recognized.

any help with a parameterized version will be greatly appreciated.

thanks alot.

-----------------------------------------------------

This is how the parameterized one looked like :

Sub AdjustBalance(Anc, Des, J, K, I)
   document.all.txtDistAmt<%=K%>.value = anc.value - des.value
   document.all.DistTot1.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt<%=K%>.value, 2) & "</b>"
End Sub

------------------------------------------------------

This is how the non parameterized one looked like :

Sub AdjustBalance(Anc, Des, J, K, I)
  If K = 1 Then
   document.all.txtDistAmt1.value = anc.value - des.value
   document.all.DistTot1.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt1.value, 2) & "</b>"
  ElseIf K = 2 Then
   document.all.txtDistAmt2.value = anc.value - des.value
   document.all.DistTot2.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt2.value, 2) & "</b>"
  ElseIf K = 3 Then
   document.all.txtDistAmt3.value = anc.value - des.value
   document.all.DistTot3.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt3.value, 2) & "</b>"
  ElseIf K = 4 Then
   document.all.txtDistAmt4.value = anc.value - des.value
   document.all.DistTot4.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt4.value, 2) & "</b>"
  ElseIf K = 5 Then
   document.all.txtDistAmt5.value = anc.value - des.value
   document.all.DistTot5.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt5.value, 2) & "</b>"
  ElseIf K = 6 Then
   document.all.txtDistAmt6.value = anc.value - des.value
   document.all.DistTot6.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt6.value, 2) & "</b>"
  ElseIf K = 7 Then
   document.all.txtDistAmt7.value = anc.value - des.value
   document.all.DistTot7.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt7.value, 2) & "</b>"
  ElseIf K = 8 Then
   document.all.txtDistAmt8.value = anc.value - des.value
   document.all.DistTot8.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt8.value, 2) & "</b>"
  ElseIf K = 9 Then
   document.all.txtDistAmt9.value = anc.value - des.value
   document.all.DistTot9.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt9.value, 2) & "</b>"
  ElseIf K = 10 Then
   document.all.txtDistAmt10.value = anc.value - des.value
   document.all.DistTot10.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt10.value, 2) & "</b>"
  ElseIf K = 11 Then
   document.all.txtDistAmt11.value = anc.value - des.value
   document.all.DistTot11.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt11.value, 2) & "</b>"
  ElseIf K = 12 Then
   document.all.txtDistAmt12.value = anc.value - des.value
   document.all.DistTot12.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt12.value, 2) & "</b>"
  ElseIf K = 13 Then
   document.all.txtDistAmt13.value = anc.value - des.value
   document.all.DistTot13.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt13.value, 2) & "</b>"
  ElseIf K = 14 Then
   document.all.txtDistAmt14.value = anc.value - des.value
   document.all.DistTot14.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt14.value, 2) & "</b>"
  ElseIf K = 15 Then
   document.all.txtDistAmt15.value = anc.value - des.value
   document.all.DistTot15.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt15.value, 2) & "</b>"
  ElseIf K = 16 Then
   document.all.txtDistAmt16.value = anc.value - des.value
   document.all.DistTot16.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt16.value, 2) & "</b>"
  ElseIf K = 17 Then
   document.all.txtDistAmt17.value = anc.value - des.value
   document.all.DistTot17.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt17.value, 2) & "</b>"
  ElseIf K = 18 Then
   document.all.txtDistAmt18.value = anc.value - des.value
   document.all.DistTot18.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt18.value, 2) & "</b>"
  ElseIf K = 19 Then
   document.all.txtDistAmt19.value = anc.value - des.value
   document.all.DistTot19.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt19.value, 2) & "</b>"
  ElseIf K = 20 Then
   document.all.txtDistAmt20.value = anc.value - des.value
   document.all.DistTot20.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt20.value, 2) & "</b>"
  ElseIf K = 21 Then
   document.all.txtDistAmt21.value = anc.value - des.value
   document.all.DistTot21.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt21.value, 2) & "</b>"
  ElseIf K = 22 Then
   document.all.txtDistAmt22.value = anc.value - des.value
   document.all.DistTot22.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt22.value, 2) & "</b>"
  ElseIf K = 23 Then
   document.all.txtDistAmt23.value = anc.value - des.value
   document.all.DistTot23.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt23.value, 2) & "</b>"
  ElseIf K = 24 Then
   document.all.txtDistAmt24.value = anc.value - des.value
   document.all.DistTot24.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt24.value, 2) & "</b>"
  ElseIf K = 25 Then
   document.all.txtDistAmt25.value = anc.value - des.value
   document.all.DistTot25.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt25.value, 2) & "</b>"
  ElseIf K = 26 Then
   document.all.txtDistAmt26.value = anc.value - des.value
   document.all.DistTot26.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt26.value, 2) & "</b>"
  ElseIf K = 27 Then
   document.all.txtDistAmt27.value = anc.value - des.value
   document.all.DistTot27.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt27.value, 2) & "</b>"
  ElseIf K = 28 Then
   document.all.txtDistAmt28.value = anc.value - des.value
   document.all.DistTot28.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt28.value, 2) & "</b>"
  ElseIf K = 29 Then
   document.all.txtDistAmt29.value = anc.value - des.value
   document.all.DistTot29.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt29.value, 2) & "</b>"
  ElseIf K = 30 Then
   document.all.txtDistAmt30.value = anc.value - des.value
   document.all.DistTot30.InnerHtml = "<b>" &
FormatCurrency(document.all.txtDistAmt30.value, 2) & "</b>"
  End If
End Sub



Sun, 08 Apr 2001 03:00:00 GMT  
 need help with parameters
Hello,

I think what is wrong in your function, it's that you use <%=K%>.
Actually you should use K in the body of the function  and call the
function like this :

    AdjustBalance Anc,Des,j,K,I

And create your dynamically your function like :

<%
Dim indice
indice = 30
%>

Sub AdjustBalance (Anc,Des,J,K,I)
    If K = 1 Then
        document.all.txtDistAmt1.value = anc.value - des.value
        document.all.DistTot1.InnerHtml = "<b>" &
        FormatCurrency(document.all.txtDistAmt1.value, 2) & "</b>"
   <%
    for p = 2 to <%=indice%>
    %>
        Elseif  K = <%=p%> Then
            document.all.txtDistAmt<%=p%>.value = anc.value - des.value
            document.all.DistTot<%=p%>.InnerHtml = "<b>" &
            FormatCurrency(document.all.txtDistAmt<%=p%>.value, <%=p%>)
& "</b>"
     <%
     end for
     %>
     End if
 End Sub

But you should not use VBScript in client scripting, you should better
use JavaScript. Because VBScript is not recognize by Netscape ...

CBF
-----------------------------------------------
Christophe Brun-Franc

BVRP Software
Service Intranet
1,bis rue collange
92593 Levallois-Perret
http://www.bvrp.com ( en anglais )
http://www.bvrp.fr ( en fran?ais )
-----------------------------------------------



Mon, 09 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Need help on parameters

2. Need help on parameters

3. Need Help with Parameters

4. I need help with parameters!!!

5. Need help setting parameter value

6. Need Help Resolving Parameter Issue

7. Need Help passing Parameters to SQL query in a VB dataenviroment

8. Help needed: Setting parameters in parameter queries

9. Help needed: Setting parameters in parameter queries

10. Need help on URL with parameter

11. homework help needed: passing a recordset as a parameter

12. Greenhorn needs Help On Recordset Parameter Query

 

 
Powered by phpBB® Forum Software