Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004

    Unanswered: Message produced when weekday = Friday

    I'm looking for Code that will allow me to program a command button whose function is to close the database to produce the message "Happy Friday and have a nice weekend" - only, of course, when the weekday becomes Friday.

    Any help will be appreciated.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    you need a mechanism to identify whether the current date is a friday.. look at the weekday function

    so you are looking to place soem code in a forms on close event...
    the problem here is trying to work out what the appropriate form is going to be. If you have a switchboard / menu that is generally left open you could put it there. you could create a hidden form that is left open, but is closed when the application exits. you could put your code there as say a msgbox. you may want to check wheter the time is appropriate (eg if you normally close at 17:00 then you could display your message at any time form say 15:00 on. as to which event you need I lleave that up to you.. but have a look at the close and unload events. you coudl use this hidden form as a mechanism to stuff semi globsal parameters or other generic applciation data. however neither seems a good reason to go down what you want.

  3. #3
    Join Date
    Apr 2004
    metro Detroit
    Use an IF statement and open a MSGBOX.

  4. #4
    Join Date
    Dec 2004
    Madison, WI
    Reminds me of when I put some code into a Timesheet app so that when the user entered "sick" time, it popped up with a message saying "Were you really sick or were you just faking it?"

    That message lasted for about 4 years in the app until someone who never took sick time entered some sick time and didn't find the message humorous.

    My favorite though is to put a popup message when the user clicks on the form's detail area which says "If you move your mouse over a button and click on that, you might get something to happen."

    Users tend to get sick of popup messages though regardless of how well intended it is (even a Happy Friday message.)

    If Format(Date(), "w") = 6 Then MsgBox "Happy Friday"
    If Format(Date(), "ddd") = "Fri" Then MsgBox "It's Friday"

    (where "w" = 1-7 for the day of the week) See Access help - User-Defined Date/Time Formats (Format Function)
    Last edited by pkstormy; 04-04-08 at 14:10.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts