Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error ParamArray

Status
Not open for further replies.

sisan

Programmer
Jan 9, 2002
39
ID
Hi, all. I have a problem here

I wrote a procedure with parameters, using ParamArray to pass variative number of parameters, and it is exactly same as the sample in MSDN.

Sub AddLists(ByVal TheKey As String, ByVal ParamArray NamaFields() As String)
...
...
End Sub

But as I leave the Sub sentence, VB tell me with the error:
Compile error:
Expected: identifier

and the word ParamArray blocked.

Help me please, I need to do so. What's wrong with it ?

sad.gif
 
Param array can not be ByVal and must be As Variant

ParamArray NamaFields()

"ParamArray Optional. Used only as the last argument in arglist to indicate that the final argument is an Optional array of Variant elements. The ParamArray keyword allows you to provide an arbitrary number of arguments. ParamArray can't be used with ByVal, ByRef, or Optional. "
Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Thanx, Yingling!

I've update my prog and it worked. But why MSDN wrote the 'wrong' sample code ?

thanx again.
 
Sorry, I submitted this thread twice at once. But I really didn't mean it.

Special thanx for Sunaj, too. You gave me the sample code.

Thanks for you all again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top