Results 1 to 3 of 3
  1. #1
    lindak is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2022
    Posts
    2

    Smile I would like to have a report to say good morning or good afternoon based on the time day

    I am new to access and just learning some basic skills. I would like to be able to say good morning or good afternoon based on the time of day. I think it can be done but don't know where to start. Please help.

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Not something I would have thought of but look at the Time() function:
    https://www.techonthenet.com/access/.../date/time.php

    https://www.msofficeforums.com/word-...ased-time.html

    Now do you get the report to "say" that is up to you, a message box in the Open event of the report, a textbox on the report itself...

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    moke123's Avatar
    moke123 is online now Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    I would like to be able to say good morning or good afternoon based on the time of day.
    Taking what you say literally . . .


    from Mike Wolfe:

    Code:
    Sub Speak(Msg As String, Optional Gender As String = "Male")
        Dim Vox As Object ' SpeechLib.SpVoice
        Set Vox = CreateObject("SAPI.SpVoice") ' New SpeechLib.SpVoice
        Set Vox.Voice = Vox.GetVoices("Gender = " & Gender).Item(0)
        Vox.Speak Msg
    End Sub
    Combine it with Vlad's


    Code:
    Sub Greeting()
    
    Select Case Time
    
         Case Is < TimeValue("12:00")
                         Speak "Good morning"
    
         Case Is < TimeValue("16:00")
                         Speak "Good afternoon"
    
         Case Else
                         Speak "Good evening"
    
        End Select
    
    End sub
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

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

Similar Threads

  1. What good is this table?
    By Lou_Reed in forum Access
    Replies: 7
    Last Post: 06-04-2017, 03:02 PM
  2. good day today
    By sanam in forum Modules
    Replies: 1
    Last Post: 04-23-2015, 07:28 AM
  3. Replies: 1
    Last Post: 03-31-2015, 08:49 AM
  4. Replies: 1
    Last Post: 05-22-2013, 09:32 PM
  5. Replies: 3
    Last Post: 12-18-2012, 10:00 AM

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