ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   3601 Too Few parameters Expected 1 (https://www.excelbanter.com/excel-worksheet-functions/164163-3601-too-few-parameters-expected-1-a.html)

Phil Smith

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?




JP[_3_]

3601 Too Few parameters Expected 1
 
Hello,

That looks like Access code, are you sure you are in the right place?
There is a ng for Access it's microsoft.public.access.modulesdaovba.


HTH,
JP


On Oct 30, 4:23 pm, Phil Smith wrote:
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?





All times are GMT +1. The time now is 02:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com