Where to insert the Where clause

Keith

Registered User.
Local time
Today, 11:24
Joined
May 21, 2000
Messages
129
I have the following code as the record source of a report. It is not my code and I have a lot to learn about coding.

SELECT tblInvoiceHeaders.* , tblQuoteLayout.*, qryQuoteItems.* FROM tblQuoteLayout, tblInvoiceHeaders INNER JOIN qryQuoteItems ON tblInvoiceHeaders.InvoiceHeaderNum=qryQuoteItems.InvoiceItemHeader;

I need to insert the following WHERE clause to select only InvoiceHeaders that are quotes.

WHERE tblInvoiceHeaders.Quote = True (Quote is a True/False field)

I have modified the code as follows

SELECT tblInvoiceHeaders.* , tblQuoteLayout.*, qryQuoteItems.* FROM tblQuoteLayout, tblInvoiceHeaders WHERE tblInvoiceHeaders.Quote = "True" INNER JOIN qryQuoteItems ON tblInvoiceHeaders.InvoiceHeaderNum=qryQuoteItems.InvoiceItemHeader;

When I open the report I get a message saying there is a syntax error in the select statement. I would appreciate any advice.
 
SELECT tblInvoiceHeaders.* , tblQuoteLayout.*, qryQuoteItems.* FROM tblQuoteLayout, tblInvoiceHeaders INNER JOIN qryQuoteItems ON tblInvoiceHeaders.InvoiceHeaderNum=qryQuoteItems.I nvoiceItemHeader WHERE tblInvoiceHeaders.Quote = "True"

I reckon it should go on the end as above, and can be followed by an order clause.
 
Thanks Uncle Gizmo for pointing me in the right direction.

SELECT tblInvoiceHeaders.*, tblQuoteLayout.*, qryQuoteItems.*
FROM tblQuoteLayout, tblInvoiceHeaders INNER JOIN qryQuoteItems ON tblInvoiceHeaders.InvoiceHeaderNum = qryQuoteItems.InvoiceItemHeader
WHERE (((tblInvoiceHeaders.Quote)=True));


It would not work to start with, no parentheses in the where statement..

I did what I should have done in the first place without worrying members of this forum, that is build a query and then look at the sql view.

Again many thanks.
 

Users who are viewing this thread

Back
Top Bottom