A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date Entry



 
 
Thread Tools Display Modes
  #1  
Old February 28th, 2005, 11:57 PM
Sondra
external usenet poster
 
Posts: n/a
Default 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  
Old March 1st, 2005, 04:19 AM
Chris2
external usenet poster
 
Posts: n/a
Default


"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  
Old March 2nd, 2005, 03:43 AM
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 02:46 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.