473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Another Too few parameters question

Hi,

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
2 1325
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
NeoPa
32,556 Expert Mod 16PB
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

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

Similar topics

1
by: Mike Wimpe | last post by:
Without creating a form, how do i pass a value to another script? I would like to pass: group = "Oranges" to another script or at least just 'group' and initialize it in the first script. ...
26
by: Paul | last post by:
public class A { public A () { // here I would like to call the second version of _ctor, how to accomplish this ? } public A (int a, int b, int c) {
2
by: ejs | last post by:
Please read the entire reponse, hopefully this clears up your questions. The data used that needs to go into the batchupload page comes from a server. My problem is that currently I write a file...
15
by: graham | last post by:
Hi all, <bitching and moaning section> I am asking for any help I can get here... I am at the end of my tether... I don;t consider myself a genius in any way whatsoever, but I do believe I have...
7
by: JJ297 | last post by:
Can't get null into the database. I'm trying to achieve... if displayedQues = "Y" then I want nondisplayedques to go into the database as null. What do I need to do? This is what I have thus...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.