View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Phil Smith Phil Smith is offline
external usenet poster
 
Posts: 50
Default 3601 Too Few parameters Expected 1

The function itself works, tested with other calls.

The call which fails is:
Colors: Concatenate("SELECT [Sizes for Items on Selected Prebook].[Size]
FROM [Sizes for Items on Selected Prebook] WHERE [Sizes for Items on
Selected Prebook].[old_sku]= """ & [Prebook Item Verify Step 1]!old_sku
& """ AND [Sizes for Items on Selected Prebook].[Color]=""" & [Prebook
Item Verify Step 1]!Color & """;")

It fails at this line in the code:

Set rs = db.OpenRecordset(pstrSQL)

At this point, pstrSQL is the parameter passed above, which resolves to
(as shown in immeditate mode)

SELECT [Sizes for Items on Selected Prebook].[Size] FROM [Sizes for
Items on Selected Prebook] WHERE [Sizes for Items on Selected
Prebook].[old_sku]= "44441129" AND [Sizes for Items on Selected
Prebook].[Color]="Black";

That string, put into it's own SQL query, properly returns 2 records.

So, the function itself works, the parameter I am passing resolves as it
should, and what it resolves to works just fine as an SQL query.

However, when that perfectly functional string is passed to

Set rs = db.OpenRecordset(pstrSQL)

It fails with 3601. Any ideas why?