Results 1 to 8 of 8
  1. #1
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123

    How to use a Day from a Specified Date in a query

    Hi,

    I have a form that will be used for rostering, It has cascading text and combo boxes to a final outcome of options based on the previous boxes.


    I have put a Text box which is set to the "Short Date" Format. What I need is a text box that can be used to display the Day of the specified Date that can also be used in a query further down the list.

    Please include any VBA code that may be required Thanks

    Dan.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    I think you need the WeekdayName() function.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123
    thanks for the reply, I am new to access so forgive my asking.
    where do I place this?
    I need to refer to the text box where the date is selected which I Named txtDate
    the box that I want the Day to be Displayed is called txtDay.
    Also I want to put an "After Update" requery on the txtDate to update the day. Do I need to put an "After Update" requery on the txtDay as well to be used in a later query?

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Try this:
    Put:
    = WeekdayName(Weekday([txtDate],2))
    as the Control Source property of the text box that is to be used to show the day.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123
    Thanks this did it, now I have the textbox showing the Day Name.
    Am I able to requery somehow when I change the date in another text box Have tried the following but it is
    not updating the day. I reallize "= WeekdayName(Weekday([txtDate],2))" is not a query but am usure how to get it to update.

    Private Sub txtDate_AfterUpdate()
    Me.txtDay.Requery
    End Sub

    It only updates when I reopen the form

  6. #6
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123
    I have it sorted thank you.

    It is updating once i have clicked in another box.

  7. #7
    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,850
    Dan,

    For Access functions and sample usage keep this for reference.

    Good luck.

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Quote Originally Posted by WickidWe View Post
    I have it sorted thank you.

    It is updating once i have clicked in another box.
    That's because the Update event fires when the focus leaves that control.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 1
    Last Post: 05-09-2013, 09:13 AM
  2. Replies: 25
    Last Post: 11-16-2012, 12:47 PM
  3. Replies: 3
    Last Post: 09-19-2012, 08:59 AM
  4. Replies: 3
    Last Post: 08-21-2012, 03:05 PM
  5. query to update a date based on another date
    By tkendell in forum Access
    Replies: 3
    Last Post: 06-29-2011, 09:32 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