Search code examples
vbscriptasp-classic

Microsoft VBScript runtime error '800a01a8' : object required


Hi i have an ASP page that call function with 2 parameters

when i call the function from the asp page i am getting this error

Microsoft VBScript runtime error '800a01a8' Object required: 'AllPerInfo4xfm(...)'

my code is

set GetAllInv = new GetFunction
set MyOrsk = GetAllInv.AllPerInfo4xfm(ssgr,nat)

my function is

Public Function AllPerInfo4xfm(ssgr,nat) 
   dim sdir,sdir2,ssec,tlen,ssec2
   tlen=len(ssgr)      
   sql ="Select * from Personal"
   myors2.Open SQl,oConn,1,1
   set Allperinfo4xf = myors2
end function

did i miss something please advice


Solution

  • Assuming that AllPerInfo4xfm() does not return an object, loose the Set in

    set MyOrsk = GetAllInv.AllPerInfo4xfm(ssgr,nat)
    

    =>

    MyOrsk = GetAllInv.AllPerInfo4xfm(ssgr,nat)
    

    Update wrt comment:

    If AllPerInfo4xfm() should return a recordset, make sure the function contains a line

    Set AllPerInfo4xfm = objRecordset 
    

    (replace objRecordset with your variable name; now, of course, the Set in the assignment to MyOrsk is needed)

    Update wrt OT's revision:

    Given the revised code, both GetAllInv and myors2 should be checked. Are they valid objects when the line is executed?

    cf. food for thought