Passing objectname to a function

Results 1 to 3 of 3

Thread: Passing objectname to a function

  1. #1
    Gerard van Oene Guest

    Default Passing objectname to a function

    Hi,<BR>I am trying to pass the name of an object to a function. In the function i want be able to do a .call to the passed objectname.<BR><BR>Here is the function:<BR><BR>Function Bladeren (iMaxrecs, Objectname)<BR> NextSet = (Request("NextSet") &#060;&#062;"")<BR> PrevSet = (Request("PrevSet") &#060;&#062;"")<BR> If NextSet Then<BR> StartRecID = (Request("EndRec"))<BR> ElseIf PrevSet Then<BR> StartRecID = Request("StartRec")<BR> StartRecID = Objectname.Call ("Get_VorigeSet", StartRecID, iMaxRecs)<BR> End If<BR>End Function<BR><BR><BR>Here is how the function is called:<BR><BR>Bladeren Maxrecs "oProject" &#039oProject is the objecname...<BR><BR><BR>This gives me the following error:<BR>Microsoft VBScript runtime error &#039 800a01a8&#039 <BR>Object required: &#039Objectname&#039 <BR><BR>Thanks in advance<BR><BR>Gerard van Oene<BR>AINO<BR>Netherlands<BR>

  2. #2
    lagerBoy Guest

    Default Not quite sure...

    Sorry, but I&#039m just really curious about what exactly the following line of code is supposed to do:<BR><BR>StartRecID = Objectname.Call ("Get_VorigeSet", StartRecID, iMaxRecs)<BR><BR>I&#039m a bit worried that my Friday night "wind-down" has left me susceptible to bouts of amnesia, so....<BR><BR>&#060;HUMBLE&#062;<BR>I would love to help you but first require some information:<BR><BR>1. Has Objectname been instantiated as an instance of an Object?<BR>2. When you say Ojectname.Call (and again this is purely my ignorance) is [Call] a method or property of Objectname?<BR>&#060;/HUMBLE&#062;<BR><BR>Please advise.<BR>

  3. #3
    Alay Guest

    Default RE: Passing objectname to a function

    Hi,<BR>I do not think that by passing the ObjectName, you can call the method of the desired object. The ObjectName is a string, thats what I figured out from the code. It must be a reference to the object. So pass the instantiated object reference, and things will work fine.

Posting Permissions

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