Results 1 to 4 of 4
  1. #1
    LarsBoer is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    3

    Convert date to weekday overview

    Hey Guys,

    I have a problem and I can't seem to solve it.

    I have a Table called Planning. In that table i have: Date, the activityID, EmployeeID, and some other irrelevant to this question.

    Now i want to create a screen in wich you can select a week. Then it will show you a view that contains the following headers:

    Code:
    Employeee  -  Monday  -  thuesday  - wednesday  -  Thurstday - friday
    
    John        -  Admin    -  mailroom   -  reception   -   admin      - reception
    Carl         -  Mailroom- Mailroom    - admin         -   admin      - admin
    Does anyone know how i can do this? ps it has to be possible to create new records...

    i hope someone can help me with this

  2. #2
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    Try the following sample method:


    • Copy the following Code into a Standard Module:


    Code:
    Public Function GetDuty(ByVal x As Integer)
        GetDuty = Choose(x, "Admin", "Mailroom", "Receiption")
    End Function
    If more options are required then add them to the list above. Selection of option depends on the value passed to the variable x.

    • Create a Table (DutyRoster) with the attached Image structure and data.
    • Copy and paste the following SQL into the SQL editing Window of a new Query and save it with the Name DutyRosterQ:

    Code:
    SELECT DutyRoster.Ename,
     GetDuty([Mon]) AS Monday,
     GetDuty([Tue]) AS Tuesday, 
     GetDuty([Wed]) AS Wednesday,
     GetDuty([Thu]) AS Thursday,
     GetDuty([Fri]) AS Friday
    FROM DutyRoster;
    • Open the DutyRosterQ in Normal view.

    If you need to convert a Date to get the number 1,2,3 then use the expression:

    Code:
    (weekday([DateFieldName]) Mod 3)+1
    to get the numbers indicated in the table fields.

    You may require a CrossTab Query as Source for the SQL given above instead of the DutyRoster Table.

  3. #3
    LarsBoer is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    3
    Thanks for your reply. But i think i didn't explain it correctly.

    The purpose of the form is to plan activities for employees. So i select by box week 43 for example. Than it will show me employees on the left. Folowed with Monday, Tuesday, etc) Beneath the day's i can select the activities for each employee. Then click save and the planning is saved in the table Planning.

    I could send you the database as an example. I should warn you, it's in dutch

    Thanks for your help,

    Lars

  4. #4
    LarsBoer is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    3

    sample

    Here is a sample form. This is how my boss would like to see the planning form.

    I'm looking forward to your response

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Number convert to date
    By Argus in forum Programming
    Replies: 1
    Last Post: 08-05-2009, 02:21 PM
  2. Convert date format yyyymmdd for datediff
    By TEN in forum Programming
    Replies: 1
    Last Post: 06-17-2009, 09:35 PM
  3. Overview
    By ReallyNeedHelp in forum Queries
    Replies: 0
    Last Post: 06-17-2009, 05:39 PM
  4. how to convert week number to date range
    By qwang1115 in forum Access
    Replies: 1
    Last Post: 02-13-2009, 11:35 AM
  5. Convert string to date
    By ~SwAmPdOnKeY~ in forum Queries
    Replies: 4
    Last Post: 09-11-2008, 07:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums