where clause

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Where do I put the where clause

SELECT Amount_Vendor_Date.Per_Diem_Amount, Amount_Vendor_Date.[Charge ID],
Amount_Vendor_Date.Service_Date, Amount_Vendor_Date.Vendor,
Amount_Vendor_Date.Cash_Amount, Amount_Vendor_Date.TA_Number,
Amount_Vendor_Date.Credit_Card_Amount, Amount_Vendor_Date.Hotel_Amount,
Amount_Vendor_Date.Notes, Amount_Vendor_Date.Departure,
Amount_Vendor_Date.Arrival, Amount_Vendor_Date.[Time Leave],
Amount_Vendor_Date.[Time Arrive],
FROM Amount_Vendor_Date
GROUP BY Amount_Vendor_Date.Per_Diem_Amount, Amount_Vendor_Date.[Charge ID],
Amount_Vendor_Date.Service_Date, Amount_Vendor_Date.Vendor,
Amount_Vendor_Date.Cash_Amount, Amount_Vendor_Date.TA_Number,
Amount_Vendor_Date.Credit_Card_Amount, Amount_Vendor_Date.Hotel_Amount,
Amount_Vendor_Date.Notes, Amount_Vendor_Date.Departure,
Amount_Vendor_Date.Arrival, Amount_Vendor_Date.[Time Leave],
Amount_Vendor_Date.[Time Arrive]
ORDER BY Amount_Vendor_Date.TA_Number;

Where [TA_Number]=Forms![Start Final TA]![TA_Number];

I tried to put this in. It tells me I dont have an operator. Or something
like that.

Thanks
Chey
 
After from ............ & before group by

Pieter

Chey said:
Where do I put the where clause

SELECT Amount_Vendor_Date.Per_Diem_Amount, Amount_Vendor_Date.[Charge ID],
Amount_Vendor_Date.Service_Date, Amount_Vendor_Date.Vendor,
Amount_Vendor_Date.Cash_Amount, Amount_Vendor_Date.TA_Number,
Amount_Vendor_Date.Credit_Card_Amount, Amount_Vendor_Date.Hotel_Amount,
Amount_Vendor_Date.Notes, Amount_Vendor_Date.Departure,
Amount_Vendor_Date.Arrival, Amount_Vendor_Date.[Time Leave],
Amount_Vendor_Date.[Time Arrive],
FROM Amount_Vendor_Date
GROUP BY Amount_Vendor_Date.Per_Diem_Amount, Amount_Vendor_Date.[Charge
ID],
Amount_Vendor_Date.Service_Date, Amount_Vendor_Date.Vendor,
Amount_Vendor_Date.Cash_Amount, Amount_Vendor_Date.TA_Number,
Amount_Vendor_Date.Credit_Card_Amount, Amount_Vendor_Date.Hotel_Amount,
Amount_Vendor_Date.Notes, Amount_Vendor_Date.Departure,
Amount_Vendor_Date.Arrival, Amount_Vendor_Date.[Time Leave],
Amount_Vendor_Date.[Time Arrive]
ORDER BY Amount_Vendor_Date.TA_Number;

Where [TA_Number]=Forms![Start Final TA]![TA_Number];

I tried to put this in. It tells me I dont have an operator. Or
something
like that.

Thanks
Chey
 
Chey said:
Where do I put the where clause

SELECT Amount_Vendor_Date.Per_Diem_Amount, Amount_Vendor_Date.[Charge
ID], Amount_Vendor_Date.Service_Date, Amount_Vendor_Date.Vendor,
Amount_Vendor_Date.Cash_Amount, Amount_Vendor_Date.TA_Number,
Amount_Vendor_Date.Credit_Card_Amount,
Amount_Vendor_Date.Hotel_Amount, Amount_Vendor_Date.Notes,
Amount_Vendor_Date.Departure, Amount_Vendor_Date.Arrival,
Amount_Vendor_Date.[Time Leave], Amount_Vendor_Date.[Time Arrive],
FROM Amount_Vendor_Date
GROUP BY Amount_Vendor_Date.Per_Diem_Amount,
Amount_Vendor_Date.[Charge ID], Amount_Vendor_Date.Service_Date,
Amount_Vendor_Date.Vendor, Amount_Vendor_Date.Cash_Amount,
Amount_Vendor_Date.TA_Number, Amount_Vendor_Date.Credit_Card_Amount,
Amount_Vendor_Date.Hotel_Amount, Amount_Vendor_Date.Notes,
Amount_Vendor_Date.Departure, Amount_Vendor_Date.Arrival,
Amount_Vendor_Date.[Time Leave], Amount_Vendor_Date.[Time Arrive]
ORDER BY Amount_Vendor_Date.TA_Number;

Where [TA_Number]=Forms![Start Final TA]![TA_Number];

I tried to put this in. It tells me I dont have an operator. Or
something like that.

Thanks
Chey

It goes after the FROM line and before the GROUP BY line.
 
And you also have an extra semi-colon in there that will break it - you
should only ever have a single semi-colon at the very end of your SQL
statement. (Ignoring the fact that the where clause is in the wrong place as
pointed out by Rick.)
ORDER BY Amount_Vendor_Date.TA_Number; <<<<< this one breaks it

Where [TA_Number]=Forms![Start Final TA]![TA_Number];

Damian.

Rick Brandt said:
Chey said:
Where do I put the where clause

SELECT Amount_Vendor_Date.Per_Diem_Amount, Amount_Vendor_Date.[Charge
ID], Amount_Vendor_Date.Service_Date, Amount_Vendor_Date.Vendor,
Amount_Vendor_Date.Cash_Amount, Amount_Vendor_Date.TA_Number,
Amount_Vendor_Date.Credit_Card_Amount,
Amount_Vendor_Date.Hotel_Amount, Amount_Vendor_Date.Notes,
Amount_Vendor_Date.Departure, Amount_Vendor_Date.Arrival,
Amount_Vendor_Date.[Time Leave], Amount_Vendor_Date.[Time Arrive],
FROM Amount_Vendor_Date
GROUP BY Amount_Vendor_Date.Per_Diem_Amount,
Amount_Vendor_Date.[Charge ID], Amount_Vendor_Date.Service_Date,
Amount_Vendor_Date.Vendor, Amount_Vendor_Date.Cash_Amount,
Amount_Vendor_Date.TA_Number, Amount_Vendor_Date.Credit_Card_Amount,
Amount_Vendor_Date.Hotel_Amount, Amount_Vendor_Date.Notes,
Amount_Vendor_Date.Departure, Amount_Vendor_Date.Arrival,
Amount_Vendor_Date.[Time Leave], Amount_Vendor_Date.[Time Arrive]
ORDER BY Amount_Vendor_Date.TA_Number;

Where [TA_Number]=Forms![Start Final TA]![TA_Number];

I tried to put this in. It tells me I dont have an operator. Or
something like that.

Thanks
Chey

It goes after the FROM line and before the GROUP BY line.
 
Create a simple query in Access, using the query design window.
Depress the Total button on the Toolbar.
Type something somewhere in the Criteria row.
Choose Ascending in the Sorting row under some field.
Switch the query to SQL View (View menu.)

You can now see the correct order of the SELECT, FROM, WHERE, GROUP BY,
HAVING, and ORDER BY clauses.
 
So this is what I have
SELECT TOP 13 Amount_Vendor_Date.Per_Diem_Amount, Amount_Vendor_Date.[Charge
ID], Amount_Vendor_Date.Service_Date, Amount_Vendor_Date.Vendor,
Amount_Vendor_Date.Cash_Amount, Amount_Vendor_Date.TA_Number,
Amount_Vendor_Date.Credit_Card_Amount, Amount_Vendor_Date.Hotel_Amount,
Amount_Vendor_Date.Notes, Amount_Vendor_Date.Departure,
Amount_Vendor_Date.Arrival, Amount_Vendor_Date.[Time Leave],
Amount_Vendor_Date.[Time Arrive]
FROM Amount_Vendor_Date
WHERE ((([TA_Number])=[Forms]![Start Final TA]![TA_Number_Flight
Info].[Form]![TA_Number]))
GROUP BY Amount_Vendor_Date.Per_Diem_Amount, Amount_Vendor_Date.[Charge ID],
Amount_Vendor_Date.Service_Date, Amount_Vendor_Date.Vendor,
Amount_Vendor_Date.Cash_Amount, Amount_Vendor_Date.TA_Number,
Amount_Vendor_Date.Credit_Card_Amount, Amount_Vendor_Date.Hotel_Amount,
Amount_Vendor_Date.Notes, Amount_Vendor_Date.Departure,
Amount_Vendor_Date.Arrival, Amount_Vendor_Date.[Time Leave],
Amount_Vendor_Date.[Time Arrive]
ORDER BY Amount_Vendor_Date.[Charge ID];

I am opening this from a command button on the form stated in the where
clause. When I go to run it, it asks for it. I can't seem to figure out
what I am doing so wrong.

Thanks
Chey

Rick Brandt said:
Chey said:
Where do I put the where clause

SELECT Amount_Vendor_Date.Per_Diem_Amount, Amount_Vendor_Date.[Charge
ID], Amount_Vendor_Date.Service_Date, Amount_Vendor_Date.Vendor,
Amount_Vendor_Date.Cash_Amount, Amount_Vendor_Date.TA_Number,
Amount_Vendor_Date.Credit_Card_Amount,
Amount_Vendor_Date.Hotel_Amount, Amount_Vendor_Date.Notes,
Amount_Vendor_Date.Departure, Amount_Vendor_Date.Arrival,
Amount_Vendor_Date.[Time Leave], Amount_Vendor_Date.[Time Arrive],
FROM Amount_Vendor_Date
GROUP BY Amount_Vendor_Date.Per_Diem_Amount,
Amount_Vendor_Date.[Charge ID], Amount_Vendor_Date.Service_Date,
Amount_Vendor_Date.Vendor, Amount_Vendor_Date.Cash_Amount,
Amount_Vendor_Date.TA_Number, Amount_Vendor_Date.Credit_Card_Amount,
Amount_Vendor_Date.Hotel_Amount, Amount_Vendor_Date.Notes,
Amount_Vendor_Date.Departure, Amount_Vendor_Date.Arrival,
Amount_Vendor_Date.[Time Leave], Amount_Vendor_Date.[Time Arrive]
ORDER BY Amount_Vendor_Date.TA_Number;

Where [TA_Number]=Forms![Start Final TA]![TA_Number];

I tried to put this in. It tells me I dont have an operator. Or
something like that.

Thanks
Chey

It goes after the FROM line and before the GROUP BY line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top