Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 38
  1. #16
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    This database has been sanitized. Open the Navigation tab for Events. The event record has two date/time fields, the child form has corresponding fields. You may play with the one of the dates in the Event record.
    SCATeam.zip

  2. #17
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    This is strange. I sent the posted a reply with the db, and I saw the post on this site, now I see the post has disappeared. I'll do it again.
    The db has been sanitized. Go to the Navigation Tab called "Events". The parent form has two date/time fields to play with. Corresponding fields are in the child from.
    Odd. Now I can see the earlier post!!!
    SCATeam.zip


    Attached Files Attached Files

  3. #18
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    The last zero just tell it to store the formatting characters in the record which uses up extra space.
    Sorry, with dates, you are wrong. If the controlsource of the control is a datetime datatype, it will store it as a date.

    Sounds like you do not know what a date datatype is - it is a decimal number (now is 43936.9675578704) the part before the dp represents the number of days since 31/12/1899 and the part after is a value expressed as the time divided by the number of seconds in a day (86400). What you see as a date is just a format of that number. So Access will convert and store 4/14/2020 07:15 to 43935.3020833333

  4. #19
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    I was just quoting from MS about the 2nd part of the input mask.
    * The second part is optional and refers to the embedded mask characters and how they are stored within the field. If the second part is set to 0, the characters are stored with the data, and if it is set to 1, the characters are only displayed and not stored. Setting the second part to 1 can save database storage space.

    https://support.office.com/en-us/art...8da#characters

  5. #20
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    yes, perhaps it's not very clear - but that is to do with storing in a text field something like a telephone number, bank sort code or card number and the like.

    You enter text into a field as a date, providing that text can be interpreted as a date, and the underlying field is a date, it will be stored as a date - otherwise it will either generate an error or truncate the value in some way depending on the nature of the error. Note that for complete hours the user will still have to enter 1700 - they can't just enter 17 - that is one of the limitations of an input mask

  6. #21
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Maybe I'm not understanding the problem. I added the input mask to the Beg_Date textbox in the subform. I enter

    041520201748

    and this is what gets displayed after I leave the textbox, as I'd expect with the format:

    04/15/2020 17:48

    Is that not what's happening for you, or not what you expect?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #22
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    Quote Originally Posted by Micron View Post
    Not sure if this will help without knowing more about what you're doing, but storing the date and time in one field is easy enough by using Now function. If you want to show date and time separately on a form, format the bound date field as a date format that you like, and an unbound textbox formatted to show Time as military time. Could be as simple as
    =Format(yourDateField,"hh:mm")
    My primary issue is having to deal with entering the colon so many thousands of times over the years. I was attempting to use the Input Mask to streamline data entry, but I have not be able to get it to work properly in my forms. He, who goes by "pbady" said he was able to get the mask to work in his test db. He is now looking at my db to try to determine why I am unable to get it to work for me. It would be nice to be able to just type "041620200845" to get "04/16/2020 08:45". Currently, I enter a space for the "/" and Access deals with it. However, I still must enter the ":", which also involves using the shift key, because Access has no flexibility regarding the colon. So, currently, I enter: "04 16 2020 8:45". Access converts it to "04/16/2020 08:45". Access with also convert "20" to "2020".

  8. #23
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    Quote Originally Posted by pbaldy View Post
    Maybe I'm not understanding the problem. I added the input mask to the Beg_Date textbox in the subform. I enter

    041520201748

    and this is what gets displayed after I leave the textbox, as I'd expect with the format:

    04/15/2020 17:48

    Is that not what's happening for you, or not what you expect?
    When I select the mask in the wizard, it inserts 00/00/0000\ 00:00;1;0; into the mask property of the Beg_Date of the main form. Then, when I return to the Form View, I get:
    Click image for larger version. 

Name:	Input Mask.JPG 
Views:	12 
Size:	74.3 KB 
ID:	41585

    If I go into that field, and delete the # characters, I see the date/time as "04/11/2020 07:30:00 AM". Then, when I exit the field, it returns to the "to big" display.

  9. #24
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    this is a simple mockup that works for me.

    In the form datefield control, check the input mask and format properties

    Note I am in the UK so the date format is dd/mm/yyyy. You may need to change to US format of mm/dd/yyyy.
    Attached Files Attached Files

  10. #25
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    My primary issue is having to deal with entering the colon so many thousands of times over the years.
    I didn't grasp from your initial post that it was about keyboard entry. I just thought you wanted to see date/time data as military time. If I had to do this, I suppose I'd try an input mask, but have rarely used them because I've read that so many people dislike their temperamental behaviour. The alternative would be a sub or function I suppose.

  11. #26
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I switched to the field you have pictured, added the input mask and it again appears to work. For the record the input mask is

    00/00/0000\ 00:00;0

    and the format is

    mm/dd/yyyy hh:nn

    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #27
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    When I select the mask in the wizard, it inserts 00/00/0000\ 00:00;1;0;
    don't - just type it in. As stated before I'm in the UK so my date format is different

    Click image for larger version. 

Name:	Capture.PNG 
Views:	13 
Size:	72.8 KB 
ID:	41588

  13. #28
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    Well, I tried it again, directly entering the mask as indicated and it seems to be working! I had earlier created the mask in the wizard and had bee using it. I had originally had the 2nd parameter as 0, but when that didn't work, I tried the 1 as indicated in the MS Guide. It still did not work. So, I guess something is wrong with the mask created in the wizard.

    Thanks everyone for your help. This should simplify data entry. It reduces 4 strokes off the data entry.

  14. #29
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    I had earlier created the mask in the wizard
    personally I avoid using wizards, they are great to get a feel for what something might look like, but much much better to grow your own. If nothing else, you know what you've done, rather than something you are not sure about

  15. #30
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Regarding your emailed question about relinking. Technical questions should be posed on the forum. You'll have a better chance at getting faster answers and it leaves a searchable archive for later users. The relevant bits:

    It occurs while putting a value into strBackEnd
    strBackEnd = Right$(strCon, (Len(strCon) - (InStrRev(strCon, "") - 1)))
    This places a “b” into strBackEnd

    Then
    tdf.Connect = ";DATABASE=" & CurrentProject.Path & strBackEnd
    produces
    ;DATABASE=D:\Scateam\SCATeam\Scateam_Site - Documents\Team Managementb
    An invalid name for the Team Management folder


    I believe this line has an error:

    strBackEnd = Right$(strCon, (Len(strCon) - (InStrRev(strCon, "") - 1)))

    based upon how it's used later, it's supposed to end up with the name of the back end file, including the backslash. I think that line should be:

    strBackEnd = Right$(strCon, (Len(strCon) - (InStrRev(strCon, "") - 1)))

    which produces:

    ?Right$(strCon, (Len(strCon) - (InStrRev(strCon, "") - 1)))
    \SCATeam_Data.accdb


    Edit: since you only sent the front end, I didn't test.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 09-16-2018, 04:58 PM
  2. Replies: 8
    Last Post: 11-16-2017, 03:07 PM
  3. Replies: 4
    Last Post: 03-19-2015, 08:43 AM
  4. Formatting military time into non-military time
    By WithoutPause in forum Access
    Replies: 3
    Last Post: 11-18-2013, 07:40 AM
  5. Replies: 42
    Last Post: 03-01-2013, 06:58 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