473,394 Members | 1,852 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,394 software developers and data experts.

Datetime format ??

hi !
i have 1 field in format date/time, in format tab i set mmm-yy.
my goal is when i type 02-05, the record will be FEB-05.
But it records May-06(current year){i think 02-May-06).
any help with appreciated.
thanks alot.
luan from Vietnam.

Nov 3 '06 #1
5 4833
You won't be able to enter the date that way.

You could enter:
Feb-2006

Alternatively, you could use 2 unbound controls - one for the month, and the
other for the year - and use their AfterUpdate event to write the value to
the (hidden) date field.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"luanhoxung" <lu********@yahoo.comwrote in message
news:68******************************@localhost.ta lkaboutdatabases.com...
hi !
i have 1 field in format date/time, in format tab i set mmm-yy.
my goal is when i type 02-05, the record will be FEB-05.
But it records May-06(current year){i think 02-May-06).
any help with appreciated.
thanks alot.
luan from Vietnam.

Nov 3 '06 #2
thank ur quickly reply, Allen !
but i feel using 2 control is inconvenience.
actually, the field i want to record is my time of shipment in my
contract.
Any solution, Allen ?
Thanks in advance.

Nov 3 '06 #3
If you want to store your data in a date field, Access has to be able to
resolve
At least the month, day and year. If you don't want to type in "01-02-05"
and only
want to type in "02-05" then you need to write a sub procedure that takes
your "02-05"
and adds an "01" to the front of that data, creating what Access needs
"01-02-05".

I would suggest that you use an unbound text control to enter the "02-05".
Have your Date field on the form but not visible.

The subprocedure would be attached to the afterupdate event of the unbound
control.

The procedure would take the "02-05" entered in the unbound control,
add the required "01" to the front and
Assign the resulting "01-02-05" to the datefield control.

Certainly the typing of the "01" seems easier and less fault prone but.....

Kevin C

"luanhoxung" <lu********@yahoo.comwrote in message
news:68******************************@localhost.ta lkaboutdatabases.com...
hi !
i have 1 field in format date/time, in format tab i set mmm-yy.
my goal is when i type 02-05, the record will be FEB-05.
But it records May-06(current year){i think 02-May-06).
any help with appreciated.
thanks alot.
luan from Vietnam.

Nov 3 '06 #4
I have given you the 2 solutions that make most sense to me.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"luanhoxung" <lu********@yahoo.comwrote in message
news:16******************************@localhost.ta lkaboutdatabases.com...
thank ur quickly reply, Allen !
but i feel using 2 control is inconvenience.
actually, the field i want to record is my time of shipment in my
contract.
Any solution, Allen ?
Thanks in advance.

Nov 3 '06 #5
thanks Allen and Kevin !
it works greatly !
Nov 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Fritz Switzer | last post by:
I'd like to have a string assigned the value of a DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" format. For example: DateTime.Now.AddMinutes(30) returns "00:30" ...
38
by: nobody | last post by:
I know that given a FormatString and a DateTime you can use DateTime.ToString(...) to convert the DateTime to a String. My question is how can you turn that around? Given a String and a...
26
by: Reny J Joseph Thuthikattu | last post by:
Hi, I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a miniute to it.How can i do that? by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004 12:00 AM'...
11
by: Cor Ligthert | last post by:
Hello everybody, Jay and Herfried are telling me every time when I use CDate that using the datetime.parseexact is always the best way to do String to datetime conversions. They don't tell why...
4
by: Arpan | last post by:
A SQL Server 2005 DB table has 4 columns namely "ID" (IDENTITY int column), "FirstName" (varchar(50)), "LastName" (varchar(50)) & "DOB" (datetime). Now when I am trying to add a new row using the...
5
by: js | last post by:
I have a textbox contains text in the format of "yyyy/MM/dd hh:mm:ss". I need to parse the text using System.DateTime.Parse() function with custom format. I got an error using the following code. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.