dr.cornwallis
Goto Top

Ersten 5 Werktage bzw. erster Montag + 5 Tage als Kriterium in Access Query

Liebe Gemeinde,

wie kann ich in Access 2010 folgendes realisieren:

Ich möchte in einer Access Query als Kriterium die ersten 5 Werktage vom aktuellen Monat haben.
Ein Feld mit Datumswerten ist natürlich vorhanden, bis jetzt schaffe ich es nur die Werte aus der Vorwoche zu filtern:

=Datum()-Wochentag(Datum())-5 Und <=Datum()-Wochentag(Datum())-1

Ich nehme mal an dass man ohne VBA keine Chance hat(überfordert).


Danke an alle!

Gruß

Dr.

Content-Key: 313848

Url: https://administrator.de/contentid/313848

Printed on: April 23, 2024 at 08:04 o'clock

Mitglied: 129813
Solution 129813 Aug 29, 2016 updated at 09:24:20 (UTC)
Goto Top
A query is a simple sql query in the background, which you can also use in access to realize that
SELECT TOP 5 
   FieldXYZ,MyDateField
FROM MYDATATABLE
WHERE ((Weekday([MyDateField])>1 And Weekday([MyDateField])<7 And Month([MyDateField])=Month(Date()) and Year([MyDateField])=Year(Date())))
ORDER by MyDateField;
(Assign your names for fields and table name)

Regards
Member: Dr.Cornwallis
Dr.Cornwallis Aug 29, 2016 at 09:37:51 (UTC)
Goto Top
Genious, works even better than my thoughts, because it pics the first 5 Values from the month, perfect.

Thank you so much!