Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    For the minutes look for the : with Instr() and Left() and Mid() functions.


    For the dates, use the Format() function and Val() for the numeric date value.

    Could even create your own function for the minutes process?
    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

  2. #17
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,563
    Hi Tinman

    I have applied Steps 2 & 3 in the attached.

    Unable to achieve Step 1 though ***Edit After Gasman's tips see the modified Db attached
    Attached Files Attached Files
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  3. #18
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Quote Originally Posted by mike60smart View Post
    Hi Tinman

    I have applied Steps 2 & 3 in the attached.

    Unable to achieve Step 1 though
    Well it is even easier.

    There are Hour() and Minute() functions, so simple math?
    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

  4. #19
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,563
    Hi Gasman

    I always find Access amazing. Have never ever used Hour() or Minute() Functions so yet again another day learning something.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  5. #20
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    There is also a Year() function.

    You have used Format property for Time and ShortTime calculated fields. Format property does not change the data. Therefore, when you reference these calculated fields in subsequent expressions, the actual values are used, not the formatted version you see. That's why the MinutesOfDay calculation returns data like "12/2/2022 8"

    Format() function does change data.

    To achieve proper sort order of string dates, need to include placeholder zeros, such as 2022-04-01. Format() can accomplish that: Format(DT, "yyyy-mm-dd"). And it just makes values appear more uniform.
    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.

  6. #21
    TINMAN is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    64
    Thank you following your recommendation I was able to create two fields one in the format 2022-01-01 and another in the format 20220101.

    Now I just need to break the time into Hour and Minutes so I can calculate total minutes of the day when the employee entrance occurs. I am going to try and use Hour and Minute expression to achieve this result.

    Thanks for your help.

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Exactly what are you trying to calculate with the Hour and Minute functions? If time is 10:00:00am and you pull 10 that is 10 hours from midnight. What purpose does it serve to calculate minutes from midnight? What do you intend to do with this value?

  8. #23
    TINMAN is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    64
    What I am trying to do is determine the frequency that an employee is trying to enter at a given minute during the day compared to his assigned entry time in minutes, thus I want to convert the entry time in hours and multiply it times 60 and then add the entry time in minutes after the hour to determine total entry time in minutes.

    Unfortunately, I am struggling to determine how to do this.

    I thought maybe I could use 24 hrs per day x 60 minutes per hour for 1,440 minutes per day to break the portion of the day into minutes.

  9. #24
    Join Date
    Apr 2017
    Posts
    1,679
    The easiest way would be calculate real date and time values in Excel, and read those (or combined datevalue) into your Access database. All your Part# values you can get easily from those imported date and time fields (or from datetime filed) formatting the control linked to apropriate field in wanted format. Or you can use either TEXT() or FORMAT() Access functions to return equivalents of your Part# values as strings.

    Excel formula examples (with your date string in cell A1):
    Code:
    Date (Probably you have edit the formulas. Almost surely you have comma as parameter delimiter, and also check what is your array delimiter in MATCH() function. I have semicolons for both):
    =DATE(MID(A1;SEARCH(",";A1;SEARCH(",";A1;1)+2)+2;4);MATCH(MID(A1;SEARCH(",";A1;1)+2;SEARCH(" ";A1;SEARCH(",";A1;1)+2)-SEARCH(",";A1;1)-2);{"January";"February";"March";"April";"May";"June";"July";"August";"September";"October";"November";"December"};0);MID(A1;SEARCH(" ";A1;SEARCH(",";A1;1)+2)+1;SEARCH(",";A1;SEARCH(",";A1;1)+2)-SEARCH(" ";A1;SEARCH(",";A1;1)+2)-1))
    
    Time:
    =TIMEVALUE(MID(A1;SEARCH(",";A1;SEARCH(",";A1;1)+2)+7;LEN(A1)-(SEARCH(",";A1;SEARCH(",";A1;1)+2)+7)+1))
    To get datetime values, you simply add both date and time formulas (DatetimeResult = DateResult+TimeResult).

  10. #25
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Quote Originally Posted by TINMAN View Post
    Thank you following your recommendation I was able to create two fields one in the format 2022-01-01 and another in the format 20220101.

    Now I just need to break the time into Hour and Minutes so I can calculate total minutes of the day when the employee entrance occurs. I am going to try and use Hour and Minute expression to achieve this result.

    Thanks for your help.
    Make sure the value you use is an actual date type, before using those functions.
    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

  11. #26
    Join Date
    Apr 2017
    Posts
    1,679
    To break TimeFieldValue value to hours
    Hours = Int(TimeFieldValue*24)
    To break TimeFieldValue to minutes
    a) whole TimeFieldValue (how much minutes from midnight)
    Minutes = Int(TimeFieldValue*24*60)
    b) remains in minutes from full hours
    Minutes = Int((TimeFieldValue*24-Int(TimeFieldValue)*24))*60)

  12. #27
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Post 9 has the result of converting to date/time data type and then using date functions to get one of the desired results in a query. Seventeen posts later it seems to be about converting strings to date/time and using Date functions.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  13. #28
    TINMAN is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    64
    Just a note to you and all the other people who commented on my original post with recommendations, as a result I have achieved what I set out to do and will I mark the post as solved.

    THANKS EVERYONE!!

    I am attaching the final sample database.
    Attached Files Attached Files

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

Similar Threads

  1. Replies: 5
    Last Post: 01-24-2018, 10:45 AM
  2. Replies: 3
    Last Post: 06-04-2017, 01:02 PM
  3. Replies: 6
    Last Post: 10-09-2014, 12:41 PM
  4. Replies: 2
    Last Post: 04-29-2014, 05:03 PM
  5. Replies: 1
    Last Post: 03-01-2013, 11:02 AM

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