Hi,
I just ran into this runtime error:
parameters cannot be arrays
which was generated by this line of code:
rs = MainDatabase.SelectSQL(sql, values)
where values() is a string array. I thought I was being smart because the SQL select statement will vary in the number of parameters it needs and rather than writing multiple individual SelectSQL statements with ParamArray of different lengths, this looked much neater.
I thought this was ok, based on the Language Reference:
Database.SelectSQL (SQLStatement as String [,ParamArray values() as Variant]) As RowSet
Database.SelectSQL (SQLStatement as String [,values() as Variant]) As RowSet
My interpretation was that you could pass either an indefinite number of parameters separately or one array that contained all the parameters.
Then I thought maybe the problem was that my values() array was of type String, not Variant, so I changed it, but then got a different runtime error:
Expected 2 parameters to be bound but received 1
I guess it then treated my passed array as just the first parameter.
I can easily work around this by just writing out separate statements for different conditions, but could someone clarify for me what the actual situation is please? What does the Language Reference mean by the second version then?