Formatting a field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Darla123
    New Member
    • Aug 2015
    • 26

    Formatting a field

    Hello, is there a way to format a field to only allow a date OR the values "IN" and "OUT"? We want people to be able to enter a date or I/O but nothing else.
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    It is not field formatting you have to deal with but form validation. Put this in the Validation Rule for the text box you are concerned with:
    Code:
    IsDate([TextBoxName])=True Or "IN" Or "OUT"
    You may also want to put something particular in the ValidationText property. This is the message text that will be displayed if the user puts an improper value in your text box.

    Jim
    Last edited by jimatqsi; Aug 26 '15, 10:14 PM. Reason: typo

    Comment

    • Darla123
      New Member
      • Aug 2015
      • 26

      #3
      This works great, thank you so much! I am really learning a lot about access from these boards.

      Comment

      • jimatqsi
        Moderator Top Contributor
        • Oct 2006
        • 1293

        #4
        Me too, Darla, I still learn something new about Access every day. So glad I could help.

        Jim

        Comment

        • Darla123
          New Member
          • Aug 2015
          • 26

          #5
          One last question, how do I build date formatting into this? Like the date can only be M/DD/YY?
          Last edited by Darla123; Aug 27 '15, 04:13 PM. Reason: grammar

          Comment

          • jimatqsi
            Moderator Top Contributor
            • Oct 2006
            • 1293

            #6
            Now you're talking about formatting. On the formatting tab of the properties you can specify mm/dd/yy for the display format. But elsewhere, reports and other screens, you'll have to display the formatting there also.

            Comment

            • Darla123
              New Member
              • Aug 2015
              • 26

              #7
              Don't I feel silly now!! Thanks again!

              Comment

              Working...