Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    westfallbp is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2021
    Posts
    26

    Making my own Time Picker

    I have 3 fields in table for this example: Appt Name, Date, (Using Date Picker), Appt Time (set to short time)



    I have a form with the fields listed on the table. However I created 3 combo boxes Col1 = 1-12 for hours on clock. Col2= 5 min increments 00-55 for min. Col3= Am or PM. Combined it matches input mask for table.

    Question How do I combine them..(thinking Col1+Col2+Col3) for a txt box then having the field Appt Time = to the txt box,,,,,Then due an after update when the AM or PM is selected.

    I would appreciate if someone had a better idea of doing this or how I should do it. THANKS!

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Use TimeValue() ?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    westfallbp is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2021
    Posts
    26
    Quote Originally Posted by Welshgasman View Post
    Use TimeValue() ?
    From what I understand is that functions pulls the time from the date. I don't want to do that. I am wanting to enter my own time for an appt that I don't have to type it in. (Thats the reason for the multi combo boxes. hour, min, AM or PM.... Thanks for the help

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,426
    I might use spinners with textboxes instead. If there was any logic as to when you would start (e.g. any time after Now() if the appointment is for the same day) then you could begin with Now in the textbox. If not, then likely the earliest time allowed then spin up from there to the max. For hours, the increment would be 1; for minutes, 5. Then use combo for AM/PM if you like. Then use TimeValue as was suggested, because it does not do what you apparently think.
    https://www.techonthenet.com/access/.../timevalue.php
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    It does do what the O/P thinks it does, but also does more.

    Code:
    ? timevalue(now())
    20:55:54 
    
    ? timevalue("8:10 PM")
    20:10:00 
    
    
    hr=8
    mm=10
    ? timevalue(hr & ":" & mm & " PM")
    20:10:00
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    westfallbp is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2021
    Posts
    26
    I know what the function does. Perhaps I am not communicating effectively.

    =[combo4] & [Combo6] & [Combo8] When I open the form it produces this result: 0515PM **All I did was combine the 3 combo results into 1 txt field. I would like to pass that to a date time field which is formated to short time which would store in that field in my table. Hopefully I clarified enough..Thanks for the help.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Formatting does not change the stored value. Value in date/time field is stored as a double. Enter "8:15:00 AM" or "08:15:00" into date/time field and the actual stored value is 0.34375.

    I don't set formatting in table and the correct format structure is displayed.

    As demonstrated in post 6, concatenate values with colons and space so Access can recognize the structure as date/time (with or without TimeValue() function). Or maybe use Timeserial([combo4], [Combo6], 0), however this requires input as military time (24-hr clock) hours.

    Show your code for saving this calculated result.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Concatenate values with colons and space so Access can recognize the structure as date/time
    As shown in post #6
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,426
    perhaps, as June7 is saying,
    [combo4] & ":" & [Combo6] & ":00 " & [Combo8]
    Or you can leave off the seconds and Access will probably add them in anyway.

    The rest of my first answer applied to this:
    I would appreciate if someone had a better idea of doing this or how I should do it.
    Maybe just different, not better.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Alternatively, save to separate fields and concatenate when needed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Quote Originally Posted by June7 View Post
    Alternatively, save to separate fields and concatenate when needed.
    My preference would be to do it once and for all.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  13. #13
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,941
    What is the benefit of using a time picker? As a user it would be quicker to just type it - use an input mask

  14. #14
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,880
    here's a class time picker
    Attached Files Attached Files
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  15. #15
    jojowhite's Avatar
    jojowhite is online now Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    439
    you can also add this code to your form:

    Code:
    Public Function fnCombosToTime()
    Dim dte As Date
    Me![Appt Time] = CDate(Nz([col1],0) & ":" & Nz([col2],0) & " " & Nz([col3],"AM"))
    End Function
    on design view of your Form, add this to the After Update Event (Property) of [col1] to [col3]:

    Code:
    =fnCombosToTime()

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access Date and Time Picker
    By jsimard in forum Queries
    Replies: 1
    Last Post: 01-24-2012, 04:04 PM
  2. Help with time picker
    By Nokia N93 in forum Access
    Replies: 1
    Last Post: 03-29-2011, 10:21 AM
  3. Time picker for Access 2003
    By Thiyagu in forum Access
    Replies: 1
    Last Post: 03-24-2010, 06:36 AM
  4. Access Runtime 2007 Date Time Picker Vista not working
    By sailinxtc in forum Programming
    Replies: 0
    Last Post: 09-17-2008, 12:56 PM
  5. Microsoft Date and Time Picker 6.0
    By That Crazy Hockey Dood in forum Forms
    Replies: 0
    Last Post: 07-25-2007, 03:22 PM

Tags for this Thread

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