Results 1 to 6 of 6
  1. #1
    frustratedwithaccess is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2014
    Posts
    35

    update query

    Hello All,

    I have two columns in a table (Table1), SamDate and DOW. SamDate contains a range of dates displayed ddd", "mmm d", "yyyy (i.e. Mon, Feb 26, 2015), and DOW contains a corresponding day code. The day codes are as follows

    1 = Sunday
    2 = Monday


    3 = Tuesday
    4 = Wednesday
    5 = Thursday
    6 = Friday
    7 = Saturday

    What I am attempting to do is update the DOW column based on the SamDate column. Below is one attempt I have made to update the DOW column:

    Update Table1
    SET DOW = 1
    WHERE SamDate = Sun;

    My plan was to run the update query with the desired day code and SamDate day replaced as needed. This has not been working for me. Any suggestions are appreciated!

    Thanks

  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Are you saying that the SamDate Column contains multiple formats? If that's the case, then you're not saving the data as a Date, you're saving it as a text string (which can be bad, especially if you're allowing multiple input formats).

    Can you give some example data from SamDate?

  3. #3
    frustratedwithaccess is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2014
    Posts
    35
    SamDate is saved as one format as given in the example in my first post (i.e. all dates appear in this format Mon, Feb 26, 2015 in the "datasheet view"). In the "design view" I have set the data type as Date/Time and the format as ddd", "mmm d", "yyyy

  4. #4
    frustratedwithaccess is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2014
    Posts
    35
    so in short I am trying to update the dow column based on the day portion of date from the SamDate column

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Why? Use the facilities of the dbms. Date data type for dates. You can always format the display anyway you want.

    Research MsAccess weekday()

  6. #6
    frustratedwithaccess is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2014
    Posts
    35
    I was unaware of the weekday function. Thanks

    Any tips on how to use this with my above question is much much appreciated

    Thanks again

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

Similar Threads

  1. Replies: 14
    Last Post: 08-12-2014, 06:33 AM
  2. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  3. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  4. Replies: 4
    Last Post: 11-10-2011, 03:41 PM
  5. Replies: 1
    Last Post: 08-19-2011, 12:16 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