473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Date Format in MS Access using a query

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
1 1495
ADezii
8,834 Expert 8TB
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

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

Similar topics

7
by: vnl | last post by:
I'm trying to run a SQL query but can't find any records when trying to select a certain date. Here's the sql: SELECT field 1, field2, date_and_time, FROM table1 WHERE date_and_time =...
3
by: Mike Dundee | last post by:
I am importing data into a new database (the database still has to be set up) and have a problem. The comma delimited text files I am importing have four fields containing date and date/times. ...
6
by: kevin carter | last post by:
hi i have a table conataining several fields one of which is date i want to be able to search the table on the date field using code. the code below generates the query from a form, however i get...
4
by: Tony | last post by:
Hey guys, I use Google Groups quite a bit as it is an enormous wealth of information, and now I need some help. I have created a query using parameters to capture a range of date, the date is...
3
by: Lyn | last post by:
Hi, I am developing a project in which I am checking for records with overlapping start/end dates. Record dates must not overlap date of birth, date of death, be in the future, and must not...
5
by: Macca | last post by:
Hi, I have a table which has a date/time field. I am storing them as follows :- 01/01/2005 11:25 01/01/2005 19:44 02/01/2005 05:04
5
by: m_t_hill | last post by:
Running MS Access 2000 MS Windows XP Pro This has caused me a lot of hair loss in the last few days so would appreciate any help. I am running code to append/update a local access database...
2
by: Julie Wardlow | last post by:
Help! I am calculating a future date using the DateAdd function in a query (the calculation also involves an IIf statement), and have managed to get this formula to produce the required result....
16
by: Mik | last post by:
I apologise if this post seems a little basic, but I am a newbie and have NO access knowledge. I have downloaded the Accounts Ledger from the Microsoft Website. It allows the user to review a...
2
by: Stevienashaa | last post by:
Hello I'm using Access 2003, and I have a query (written in SQL) which has two parameters and asks the user for two dates. This has been working fine. Today I modified the query, removing the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.