please help asap .. query based on a date

Molemanex

Registered User.
Local time
Today, 20:29
Joined
Jan 3, 2006
Messages
27
:confused: i am trying to develop a system which requires a date order to be used .. i want to use a filter query to filter out certain information from my tables into a form .. i know how to accomplish this but i am having a small problem getting there
i wish to set sunday to an order of one (1) and monday to two (2) and so on so that when i create my query i will be able to select the thursday for example ( by setting the criteria to a "5" )
i have a table consisting of the dates but i am unsure how to create a field that displays the order .. automatically calculating whether the date is a sunday or a monday and assigning the correct number as stated above, i have tried something (not sure what) which assigned a 1 to monday through 7 to sunday but this is not the order i wish to use and it failed to work with my query anyway
would this create this using my computers clock or something and if so what do i need to do to get this small part of my system up and running therefore enabling me to create my filter query
please help
thankyou :)
 
There is something I think within Date or Datepart or dimilar in the Help. This does indeed enable you to detect day of week and assign a number reference

Len
 
i found some stuff involving "w" for the week day .. but im still really confused .. where would i put this ( in my table .. in my query??) and how do i make it so that the "w" of sunday is equal to 1 , the "w" of monday = 2 etc etc ...
 
Check the Help on Weekday Function
Syntax

Weekday(date, [firstdayofweek])

The Weekday function syntax has these named arguments:

Part Description
date Required. Variant, numeric expression, string expression, or any combination, that can represent a date. If date contains Null, Null is returned.
firstdayofweek Optional. A constant that specifies the first day of the week. If not specified, vbSunday is assumed.
Settings

The firstdayofweek argument has these settings:

Constant Value Description

vbUseSystem 0 Use the NLS API setting.
vbSunday 1 Sunday (default)
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday
Return Values

The Weekday function can return any of these values:

Constant Value Description

vbSunday 1 Sunday
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday

Len
 

Users who are viewing this thread

Back
Top Bottom