Solved

VBScript runtime error '800a01c1'

Posted on 2002-05-27
9
1,527 Views
Last Modified: 2012-06-27
Hey Everyone,

I am getting this error when I am trying to access a vb component.  Is it because my component is not registering properly?  Does anyone have any suggestions?

Microsoft VBScript runtime error '800a01c1'

Argument not optional: 'GenerateExcelReport'

/excelreportmts.asp, line 69
0
Comment
Question by:rickydoyle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 23

Expert Comment

by:b1xml2
ID: 7037491
it is not that the component has not been registered. Your component has been successfully registered. The method requires an additional argument e.g.
GenerateExcelReport 1
or
GenerateExcelReport "string"

You have to know what arguments are required by this method and what data type is required, be they string, boolean or numeric or others.
0
 

Author Comment

by:rickydoyle
ID: 7037498
Ok, this is what I have in my asp page where I am gettign the error

sPath =oReport.GenerateExcelReport(cStr(strmaster),cStr(strRtype))

Then within my vb class I have this code
Public Function GenerateExcelReport(Master, RType) As String

To me everything looks fine with that so that is why I am confused on this.  

0
 
LVL 23

Accepted Solution

by:
b1xml2 earned 100 total points
ID: 7037526
Firstly,
your function shd be
Public Function GenerateExcelReport( _
ByVal Master As String, _
ByVal RType As String) As String

End Function

If you do not specify that, then the default is ByRef which may be the cause of the problem.

Check http://support.microsoft.com/search/preview.aspx?scid=kb;en-us;Q197956

If you are passing by reference then, you must specify as variant

Public Function GenerateExcelReport(ByRef Master As Variant, ByRef RType As Variant) As String
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:b1xml2
ID: 7037529
It may be that this may not be the cause of the problem. However, you should change your parameter types as this is considered prudent coding and unless you want to use the arguments's values which may be changed via the function, use the ByVal keyword instead.
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 7037533
also have a look at this

http://support.microsoft.com/search/preview.aspx?scid=kb;en-us;Q244012

INFO: Type Mismatch Errors When You Pass Parameters from ASP to a Visual Basic Component (Q244012)
0
 

Author Comment

by:rickydoyle
ID: 7037599
I am unsure right now, I have looked at both articles and from the info you gave me everything looks like it should flow correctly but it is not.  I just installed IIS on my machine, would it have anything to do with settings I may have set up?
0
 
LVL 25

Expert Comment

by:clockwatcher
ID: 7038469
Does your component work outside of ASP?  Maybe something going on inside your component is throwing the error?
0
 
LVL 9

Expert Comment

by:Nitin Sontakke
ID: 7038885
This is just a random suggestion. You may NOT implement it. However, my experience with ASP / VB communication has following to share with you.

As VBScript (in which we write asp files) being a scripting language, does not support strongly typed variables, by default.

Somehow, i have never experienced problem with sending Integer as a function return value from VB to ASP. For this reason, i would recommend you to return integer value from VB function as -1 (Success) or 0 (Failure) in the function.

For returning string value to ASP, add yet another parameter ByRef.

After modifications, if you choose to do, your code will look something as follows:

VB:

Public Function GenerateExcelReport( _
ByVal Master As String, _
ByVal RType As String, _
ByRef strReturn As String) As Integer

ASP:

Dim iReturn, sPath

iReturn = oReport.GenerateExcelReport(cStr(strmaster),cStr(strRtype), sPath)

If iReturn <> 0 Then
   'Error occured in component.
End If
0
 
LVL 9

Expert Comment

by:Nitin Sontakke
ID: 7038892
Sorry, it should have been:

If iReturn = 0 Then
  'Error occured in component.
End If

You know what i am trying to say, anyway.

Also, this takes care of scenario "clockwatcher" is referring to.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question