Date format

T

Tom

Hi all,
In my table I have field : OrderDate which is a date.
on a form I have a comboBox which has to be populate with only the year from
OrderDate.
How do I setup the eaw source?

TIA,
Tom
 
R

Rick Brandt

Tom said:
Hi all,
In my table I have field : OrderDate which is a date.
on a form I have a comboBox which has to be populate with only the year from
OrderDate.
How do I setup the eaw source?

SELECT Year(YourDateField)
FROM YourTable
 
T

Tom Lake

Tom said:
Hi all,
In my table I have field : OrderDate which is a date.
on a form I have a comboBox which has to be populate with only the year
from OrderDate.
How do I setup the eaw source?

TIA,
Tom

=Year([OrderDate])

Tom Lake
 
T

Tom

Thank you both, it worked but didnt serve my purpose.

Q1. I have a chart based on a query based on Orders table
the citiria for that quey is comboboxes on form(Form1) Year and Product.
when I choose 2006and product the query return 0.
the date format in the table is short date.
What is wrong?
Q2. I n the Orders table there are many records from 2006.
When I use the select statment, I get 2006 for each record, how do I
geoup them?

TIA,

Tom


Tom Lake said:
Tom said:
Hi all,
In my table I have field : OrderDate which is a date.
on a form I have a comboBox which has to be populate with only the year
from OrderDate.
How do I setup the eaw source?

TIA,
Tom

=Year([OrderDate])

Tom Lake
 
R

Rick Brandt

Tom said:
Thank you both, it worked but didnt serve my purpose.

Q1. I have a chart based on a query based on Orders table
the citiria for that quey is comboboxes on form(Form1) Year and Product.
when I choose 2006and product the query return 0.
the date format in the table is short date.
What is wrong?

What is your query? You can't use a Year (Integer) to set criteria on dates.
You would have to convert the Year value to a range of dates that includes the
entire year. The DateSerial() function can do this for you.

SELECT * FROM TableName
WHERE DateField Between DateSerial(Forms!FormName!ComboBoxName, 1, 1) AND
DateSerial(Forms!FormName!ComboBoxName, 12, 31)
 
T

Tom

Thank you Rick - like magic.
How do I group the year, so when I open the combo box I see the year only
once?

wow,
Thanks a lot
Tom
 
R

Rick Brandt

Tom said:
Thank you Rick - like magic.
How do I group the year, so when I open the combo box I see the year only
once?

In the design of the RowSource query open the property box and set Unique Values
property to Yes.
 
T

Tom

Rick,
I have learned so much.

Thank you,
Tom
Rick Brandt said:
In the design of the RowSource query open the property box and set Unique
Values property to Yes.
 
Top