If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Date Entry
Well I know this is possible, but I'll be darned if I can
figure it out. I want to enter a date as 01012005 and have it show 01/01/2005 or 010105 as 01/01/05. Please advise how this is done. Everything I try doesn't work. Thanks in advance |
#2
|
|||
|
|||
"Sondra" wrote in message ... Well I know this is possible, but I'll be darned if I can figure it out. I want to enter a date as 01012005 and have it show 01/01/2005 or 010105 as 01/01/05. Please advise how this is done. Everything I try doesn't work. Thanks in advance Sondra, Open Access. On the menus, go to Tools Macro Visual Basic Editor (VBE). Insert a new Module and paste in the following code. Public Function TestDateEntry() As Date Dim intMonth As String Dim intDate As String Dim intYear As String Dim strEntry As String Dim dtmCvnrtdDate As Date ' This may need to be inside a loop for data validation. strEntry = InputBox("Enter Date", "Date Entry") intMonth = CInt(Left(strEntry, 2)) intDate = CInt(Mid(strEntry, 2, 2)) intYear = CInt(Right(strEntry, 4)) dtmCvnrtdDate = DateSerial(intYear, intMonth, intDate) TestDateEntry = dtmCvnrtdDate End Function On the menus in the VBE, View Immediate. Type in the Immediate Window: type "? TestDateEntry()", without the quotes, and press enter. The main Access Window will jump to the forefront, and an inputbox will appear. Type in 01012005, just like that, and press enter. 01/01/2005 will appear in the Immediate Window (and what's more, it's even a Date data-type). Sincerely, Chris O. |
#3
|
|||
|
|||
PARAGRAPH FORMAT
-----Original Message----- Well I know this is possible, but I'll be darned if I can figure it out. I want to enter a date as 01012005 and have it show 01/01/2005 or 010105 as 01/01/05. Please advise how this is done. Everything I try doesn't work. Thanks in advance . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Filtering on custom date field | MED | Contacts | 3 | September 17th, 2004 03:05 PM |
some problems in date entry in a web bsed statement | R.VENKATARAMAN | General Discussion | 5 | August 10th, 2004 07:50 PM |
Aggregating Date Data into Weeks and Quarters | Roger | Running & Setting Up Queries | 3 | July 11th, 2004 05:56 PM |