A.D.Tejpal
adtp at touchtelindia.net
Mon Oct 6 13:44:26 CDT 2003
John, The following course of action is suggested - (a) Input Mask property of the text box may be set as - 99-99-9999; ; _ (b) The code given below may be used in the Enter and BeforeUpdate events of the text box (named TxtDt). The latter is needed in order to ensure compliance with mm-dd-yyyy. (Had we been able to adopt 00-00-0000; ; _ as the input mask straightaway, this validation would not have been called for). Regards, A.D.Tejpal -------------- ------------- Code Start ------------- Private Sub TxtDt_Enter() If Len(TxtDt) > 0 Then Else TxtDt = " - -" & Year(Date) TxtDt.SelStart = 0 TxtDt.SelLength = 0 End If End Sub Private Sub TxtDt_BeforeUpdate(Cancel As Integer) Dim TXT As String ' Replace space in TXT variable with zero length string TXT = Replace(TxtDt.Text, " ", "") If Len(TXT) > 0 And Len(TXT) < 10 Then MsgBox "Date And Month Parts " & _ "Should be Two Digits Each" & _ vbCrLf & "Year Part Should Be Four Digits" Cancel = 1 End If End Sub ------------- Code End ------------- ----- Original Message ----- From: John Colby To: Access Developers discussion and problem solving Sent: Monday, October 06, 2003 21:00 Subject: RE: [AccessD] Date data entry >Would they accept the default set to =date()? Where logical I do that, however in these cases they are entering dates out in the future or in the past. John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Mitsules, Mark Sent: Monday, October 06, 2003 10:55 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Date data entry Would they accept the default set to =date()? Mark -----Original Message----- From: John Colby [mailto:jcolby at colbyconsulting.com] Sent: Monday, October 06, 2003 10:44 AM To: AccessD Subject: [AccessD] Date data entry I have a specific client that LOVES the input masks for dates. I don't understand this as I personally hate them, but... What they want is to have something like that but which "assumes current year", i.e. all they have to enter is the ddmm and the rest (the year) is filled in. Does anyone do this? Know how to do this? John W. Colby www.colbyconsulting.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20031007/9115e087/attachment-0001.html>