Testing for a specfic format value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kwisco
    New Member
    • Oct 2012
    • 2

    Testing for a specfic format value

    I have a series of Access Queries that run depending on the day of the week. The user chooses a date from a pull down calendar (ie 10/1/2012). I want to find out what day of the week 10/1/2012 is (Monday in this case.) and then test for that value to execute the proper query... I am not very conversant in VB, so please be detailed in your explaination.

    Thanks for your time and assistance.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    The Weekday() function will tell you which day of the week it is, where 1 is sunday, 2 is monday, and so on. You can use that with a case statement to run the query of your choice.

    If you do not understand how to implement this, you should look into a VBA class/tutorial before trying to take on a project of this scope.

    If you have trouble implementing it, post the code you tried and we can help you spot the problems.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      What technology are you using... VB.NET or VBA?

      In .NET you can use the DatePicker control to allow the user to choose a date. It has a property called SelectedDate which returns you a DateTime type.

      The DateTime type has a DayOfWeek property that will tell you which day of the week the user selected.


      -Frinny

      Comment

      • kwisco
        New Member
        • Oct 2012
        • 2

        #4
        Thank you both for your assistance. The project I was doing this for has been scrapped so it was all for naught!

        Comment

        Working...