By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,841 Members | 1,761 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,841 IT Pros & Developers. It's quick & easy.

Another Too few parameters question

P: 2

I've read (on here and MSDN and Microsoft support!) about parameter queries, and in the past have managed to resolve this problem.

Trouble is the sql below is asking for three parameters and I can't see why! Can anybody help me please?

[code] ssql = "SELECT DISTINCTROW Customers.Code, [Sales Orders].Invoiced, NextInvoiceNumber.InvoiceNo,"
ssql = ssql & "[Sales Orders].[Facelift Order No], [Sales order totals with customer info].Total,"
ssql = ssql & "Customers.Name, Customers.Address1, Customers.Address2, Customers.Address3, Customers.Town, Customers.County,"
ssql = ssql & "Customers.Postcode, [Sales Orders].Date, [Sales Orders].InvoiceNumber, [Sales Orders].Terms "
ssql = ssql & "FROM NextInvoiceNumber, Customers INNER JOIN ([Sales Orders] INNER JOIN"
ssql = ssql & "[Sales order totals with customer info] ON [Sales Orders].[Facelift Order No]"
ssql = ssql & "= [Sales order totals with customer info].[Facelift Order No])"
ssql = ssql & "ON Customers.Code = [Sales Orders].Code WHERE (Customers.Code)=" & Forms!frmCustomers!
Expand|Select|Wrap|Line Numbers
  1.  & ""
  2.     ssql = ssql & "AND (([Sales Orders].Invoiced) = 0)"
Dec 5 '06 #1
Share this Question
Share on Google+
2 Replies

P: 2
Just a bit more detail ...

I have tables for Customers, Sales Orders, Sales Order Lines, Invoices and NextInvoiceNumber. What I am trying to do is find sales orders for the current customer which have not yet been invoiced and total the sales order lines (many to one relationship with the sales orders), while at the same time selecting the next invoice number from the table.

It all seemed to work at one time, yet now returns the error 'Too few parameters. Expected 3'

Help please!

Mark Dudley
Dec 5 '06 #2

Expert Mod 15k+
P: 31,660
If you look carefully at the last two lines of your code, you will see the AND is separated from the previous number ([code]) by an empty string instead of a space.
This is easier to spot if you put the tags around it.
When debugging code like this and it's not working, always Debug.Print the string (ssql) for clues as to what it's ACTUALLY trying to do.
Dec 5 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.