Results 1 to 3 of 3
  1. #1
    joe55555 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    24

    can i put a string in DATE/TIME default value ?

    hello all,



    i have a small software for my company i am only facing one problem in the DATE/Time Default Value

    I try to writea string its says: "type mismatch"

    i want when adding a new record to appear in the Date/Time fields the following format "MM/DD/YYYY"
    i don't want it to appear when i click on it, i did this using input mask

    I just want the default value to show like "MM/DD/YYYY" when a new record is added and the user choose a date it become the date he chose.

    Thank you

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Welcome to the forum

    No, you cannot write a string to a Date/Time field default value.

    Set the default value for the field to "Date()" (no quotes)

    If you want to give a hint as to how the date should be entered, create a label, set the caption to "(MM/DD/YYYY)", Set the font size to something like 6 and place the label above or below the text box control for the date.

  3. #3
    joe55555 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    24
    ssanfu thank you.

    i was thinking about something but i don't know if it can work.

    if i add vba code testing if the filed Date/Time of the table is empty so this shows a Label "MM/DD/YYYY" on the TextBox in the Form
    and if the field Date/Time of the table is not empty, so this will hide the label "MM/DD/YYYY" and the Date will appear in the textbox in the Form

    is this possible to do ? if yes, can anyone please give me a hint of the code !?

    thank you

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

Similar Threads

  1. Replies: 4
    Last Post: 03-06-2013, 02:32 PM
  2. Converting a string to date/time
    By RayMilhon in forum Programming
    Replies: 8
    Last Post: 09-28-2012, 10:02 AM
  3. Replies: 12
    Last Post: 02-22-2011, 03:39 PM
  4. Replies: 2
    Last Post: 07-03-2010, 08:45 PM
  5. Split string into Date and Time Columns?
    By Hobbes29 in forum Queries
    Replies: 2
    Last Post: 06-08-2010, 06:50 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