Display only the last 3 days in a cobbo box?

KevinSlater

Registered User.
Local time
Today, 08:13
Joined
Aug 5, 2005
Messages
249
Hi i have a query named "query-shifts" which has a field in it named: "shift_date" a form named: "Form-Attendance" reads information into this query, is is possible to have a drop down list box (combo box) which displays just the last 3 days (including the current date), i would like the user to be able to select one of these dates and store it.

ive tried the following code in the criteria field of "shift_date" in the query:

>=DateAdd("d",-3,Date())


and have created a cobo box in the form that looks at this field in the query, it does display the last 3 days in the drop down list but shows each date twice, i think this is because i have different shifts in the query with the same date, any help on how i can just show the last three dates the once would be great?
 
Hi Kevin!
My suggestion would be to change your query used as record source for your Combo box from simple selection query to Summarizing query - you will Group your field "shift_date" so you will get it in the result only once. Then, you can sort it in "descending" mode and in SELECT statement you can use a clause "SELECT TOP 3 .........." instead "SELECT".

Regards

Krava
 
Hi Krava, apologies for my late reply (been away over my cousins & away from my PC). Thanks for your help, ive tried what you suggested but its not quite what i want, but its a step in the right direction cheers

.....What i really want is to have the shift date look at the last three days from the system date not from the query, displayig these 3 days in a drop down list in the form and then storeing the selected date in the query/table. Any sugestions on how i can do this would be really great??
 
Last edited:

Users who are viewing this thread

Back
Top Bottom