Passing Parameters to VBS Sub

Results 1 to 4 of 4

Thread: Passing Parameters to VBS Sub

  1. #1
    Daniel Guest

    Default Passing Parameters to VBS Sub

    Im trying to pass Two values to a client side VBS function. I can pass one but when I try to I get all kinds of errors.<BR><BR>Here is what Im trying<BR><BR>onclick=GoDetail(" & ssn & "," & pay_date & ")<BR><BR>I get a "cannot use parenthesis when calling a sub " error<BR><BR>Any suggestions will help

  2. #2
    David Brower Guest

    Default RE: Passing Parameters to VBS Sub

    Hi there!<BR><BR>In this case I would follow the advice of the error message and remove the parenthesis! VBScript sub are called as follows:<BR><BR>validate_form 1st argument,2nd argument<BR><BR>Sub validate_form(1st argument, 2nd argument)<BR><BR>&#039do stuff<BR><BR>End Sub<BR><BR>David

  3. #3
    Daniel Guest

    Default RE: Passing Parameters to VBS Sub

    Cool I got that part.....but when I hand the date into the Sub procedure and try to use it, the sub procedure does math on the date<BR><BR> I pass 6/6/2000 I get .0005 in the sub

  4. #4
    Join Date
    Dec 1969

    Default RE: Passing Parameters to VBS Sub

    You can force a date to be a literal in VBS by surrounding it with #...#, I believe. (But maybe that&#039s only in VBS and not VBS?)<BR><BR>Well, worst come to worst, you could always code:<BR><BR><BR>Response.Write "theSub CDate(""" & aspDate & """)," & otherArg & ")" & vbNewLine<BR><BR>or something akin to that.<BR><BR>Note: In your original post, you had written:<BR><BR>Response.Write "someVariable = theSub(...."<BR><BR>If you need to do this, then the thing you are calling a Sub should be a Function, instead, in order to return a value to be assigned to the variable, in which case you put the parens back in.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts