1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Access 2003 - Format field to Short Date

Discussion in 'Business Applications' started by gfg, Aug 28, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. gfg

    gfg Thread Starter

    Joined:
    Aug 18, 2005
    Messages:
    128
    Hello

    Access 2003
    Windows XP

    I am creating a new table and would like to format a field to short date. Here is my code. Is there a way to format to short date from here?

    Thanks

    Set fld = tbl.CreateField("Date", dbDate)
    fld.Required = True
    tbl.Fields.Append fld
     
  2. b_boboci

    b_boboci

    Joined:
    Aug 9, 2007
    Messages:
    13
    try this:
    fld.NumberFormat = "m/d/yyyy"
     
  3. gfg

    gfg Thread Starter

    Joined:
    Aug 18, 2005
    Messages:
    128
    fld.NumberFormat = "m/d/yyyy" does not work

    Thanks
     
  4. gfg

    gfg Thread Starter

    Joined:
    Aug 18, 2005
    Messages:
    128
    Here is the code that works:

    Set fld = tbl.Fields("Date")
    Set prpProperty = fld.CreateProperty("Format", dbText, "Short Date")
    fld.Properties.Append prpProperty

    where prpProperty is a Property object
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/616356

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice