query

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

Guest

I Am having trouble with a Query. I want to use an "orderdate" in a combobox
to select dates for reports.
Here is what the query looks like: "SELECT DISTINCT
tblNewTransfer.[OrderDate] FROM tblNewTransfer ORDER BY
tblNewTransfer.OrderDate;". The problem is that it is not selecting distinct
dates it select all the dates which lists numerous duplicates. How can I
insure that the cbo will select only each different date with no duplicates?
 
I Am having trouble with a Query. I want to use an "orderdate" in a combobox
to select dates for reports.
Here is what the query looks like: "SELECT DISTINCT
tblNewTransfer.[OrderDate] FROM tblNewTransfer ORDER BY
tblNewTransfer.OrderDate;". The problem is that it is not selecting distinct
dates it select all the dates which lists numerous duplicates. How can I
insure that the cbo will select only each different date with no duplicates?

As Jason says, the problem is that your OrderDate field probably has values
like #11/17/2007 11:24:31am# and #11/17/2007 02:16:28pm# - which ARE distinct
values, though they will look the same if you format the field to show the
date portion only.

Try

SELECT DISTINCT DateValue(tblNewTransfer.[OrderDate]) FROM tblNewTransfer
ORDER BY DateValue(tblNewTransfer.OrderDate);

to truncate it to just the date portion.

John W. Vinson [MVP]
 
Try this ---
SELECT DISTINCT DateValue(tblNewTransfer.[OrderDate]) FROM tblNewTransfer
ORDER BY DateValue(tblNewTransfer.OrderDate);

--
KARL DEWEY
Build a little - Test a little


Jason Lepack said:
They are distinct. They include times as well as dates though.

I Am having trouble with a Query. I want to use an "orderdate" in a combobox
to select dates for reports.
Here is what the query looks like: "SELECT DISTINCT
tblNewTransfer.[OrderDate] FROM tblNewTransfer ORDER BY
tblNewTransfer.OrderDate;". The problem is that it is not selecting distinct
dates it select all the dates which lists numerous duplicates. How can I
insure that the cbo will select only each different date with no duplicates?
 

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