By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,985 Members | 1,694 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,985 IT Pros & Developers. It's quick & easy.

Date Format in MS Access using a query

P: 2
Date Format in MS Access using a query

Hi

I want to alter the existing column's format using the alter query. The issue I am facing is I want to set the default date format of an existing "Date_Edit" column in "DD/MM/YYYY" format irrespective of Date format of the Operating System.
It would also be really appreciable if any body provides me the details regarding altering the attributes of an existing column.

Thanks and Regards
Sathya
Mar 17 '07 #1
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,628
Date Format in MS Access using a query

Hi

I want to alter the existing column's format using the alter query. The issue I am facing is I want to set the default date format of an existing "Date_Edit" column in "DD/MM/YYYY" format irrespective of Date format of the Operating System.
It would also be really appreciable if any body provides me the details regarding altering the attributes of an existing column.

Thanks and Regards
Sathya
The best way to show you how you can Set/Retrieve Column Attributes is via an illustration. The following code will display certain Properties for a [DOB] (DATE) Field in tblEmployees. It will also modify its Default Value via 2 seperate Methods. Any other questions, feel free to ask.
Expand|Select|Wrap|Line Numbers
  1. Dim MyDB As DAO.Database, MyTDF As DAO.TableDef
  2. Set MyDB = CurrentDb()
  3. Set MyTDF = MyDB.TableDefs("tblEmployees")
  4.  
  5. With MyTDF
  6.   Debug.Print "Allow Zero Lewngth: " & .Fields("DOB").AllowZeroLength
  7.   Debug.Print "Attribute Value: " & .Fields("DOB").Attributes
  8.   Debug.Print "Data Updateable: " & .Fields("DOB").DataUpdatable
  9.   Debug.Print "Default Value: " & .Fields("DOB").DefaultValue
  10.   'Change the Field's Default Value to #12/12/1960#
  11.   .Fields("DOB").DefaultValue = #12/12/1960#        'OR
  12.   CurrentDb.TableDefs("tblEmployees").Fields("DOB").DefaultValue = #12/12/1960#
  13.   Debug.Print "Input Mask: & .Fields("; DOB; ").Properties("; InputMask; ").Value"
  14.   Debug.Print "Name: " & .Fields("DOB").Name
  15.   Debug.Print "Ordinal Position: " & .Fields("DOB").OrdinalPosition
  16.   Debug.Print "Number of Properties: " & .Fields("DOB").Properties.Count
  17.   Debug.Print "1st Property Name: " & .Fields("DOB").Properties(0).Name
  18.   Debug.Print "6th Property Name: " & .Fields("DOB").Properties(5).Name
  19.   Debug.Print "Required Field: " & .Fields("DOB").Required
  20.   Debug.Print "Field Size: " & .Fields("DOB").Size
  21.   Debug.Print "Source Table: " & .Fields("DOB").SourceTable
  22.   Debug.Print "Field Type: " & .Fields("DOB").Type
  23.   Debug.Print "Validation Rule: " & .Fields("DOB").ValidationRule
  24.   Debug.Print "Validation Text: " & .Fields("DOB").ValidationText
  25. End With
Mar 17 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.