Results 1 to 12 of 12
  1. #1
    radguy is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    32

    Fixing the Date/Time data type so that it display the date and time and not just the date.

    I am having trouble getting the proper format in a field where I would like to track the date and time that is inputted into my inventory tracking database. It is ONLY recording the date that I inputs into the database. In the table titled, replacement event, I have 6 fields that have the data type of date/time. In each of them the format is General Date. I would like to be able to record the date AND time but it only records the date Can anyone help me figure out how to display the time AND the date?

    Attached are pics of my in design and datasheet view. Let me know if you need anymore pics.

    Thanks
    Attached Thumbnails Attached Thumbnails Screenshot of table.JPG   Screenshot of datasheet view.JPG  

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Try not applying any format to the field.

    Can set DefaultValue property of [Date Tool Taken Out of CCAM] to Now() and the date/time will automatically populate when record is created.

    Advise no spaces or special characters/punctuation (underscore is exception) in naming convention. Those are very long field names. Why not simply DateOut?
    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.

  3. #3
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    The words of Professor (June) True
    And for more information see here
    http://office.microsoft.com/en-ca/ac...474.aspx?CTT=1
    Click image for larger version. 

Name:	1.PNG 
Views:	14 
Size:	7.7 KB 
ID:	17385

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    The Default Value cannot be set to Date(), as that only returns the date portion! It has to be set to Now() as June7 suggested! Now() returns both the date and time component.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    radguy is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    32
    Is there a way to edit the time? or put in a specific time. I would like to track how much time it takes to do a specific task and I do not want the time the time that it is completed to automatically populate. Is there a way I can add a button to be pressed once a task is finished and then the time it's press the time is populated?

    Here is a screenshot of what my form looks like:
    Click image for larger version. 

Name:	Time.JPG 
Views:	14 
Size:	34.5 KB 
ID:	17386

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Sure. Can certainly type the date and/or time. But most users find that annoying, even with the aid of input mask.

    Can use code to populate field. I use VBA.

    Me.tbxStart = Now()
    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.

  7. #7
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Professor (Missinglinq)
    It works well with me
    Look at the pictures
    Click image for larger version. 

Name:	22.PNG 
Views:	14 
Size:	16.4 KB 
ID:	17387Click image for larger version. 

Name:	33.PNG 
Views:	14 
Size:	20.4 KB 
ID:	17388

  8. #8
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by June7 View Post

    Can use code to populate field. I use VBA.

    Me.tbxStart = Now()
    You can use this code behind a Command Button, or, and I've used this before, place the code in the DoubleClick event of the Control; you DoubleClick on tbxStart and it is populated.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  9. #9
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by azhar2006 View Post
    Professor (Missinglinq)
    It works well with me
    Look at the pictures
    Your example in Post #7 shows the Default Value set to Date() which will only populate the field with the date portion; it doesn't matter that the Datatype is set to Date/Time! The poster of this thread wants the date and time, which requires the use of Now()!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  10. #10
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Ahaaaa
    Unfortunately, I understand the question by mistake
    Unfortunately renew

  11. #11
    radguy is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    32
    Can someone post a screenshot of the proper way to code Me.tbxStart = Now()? I am new to using VBA and I am not 100% sure the correct way to input it into the database. I would like to add it to the Dbl Click event of the field in the property sheet.

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    tbxStart is example of name for a textbox. Use whatever name you have assigned to the textbox or use the fieldname directly.

    Do you want macro or VBA? I use only VBA and that is the example given.

    Select [Event Procedure] in the event property then click the ellipsis (...) to open the VBA editor. Type code.

    http://office.microsoft.com/en-us/ac...010341717.aspx
    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.

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

Similar Threads

  1. Subtracting a date/time field from a number to get date/time
    By Lifeseeker1019 in forum Programming
    Replies: 4
    Last Post: 03-28-2014, 12:59 PM
  2. Replies: 1
    Last Post: 03-13-2014, 07:23 PM
  3. Replies: 4
    Last Post: 03-06-2013, 02:32 PM
  4. Replies: 1
    Last Post: 08-07-2011, 07:58 AM
  5. Replies: 6
    Last Post: 01-04-2011, 05:43 PM

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