Alex said:
is it possible to enter a two digit number ( in a feild on a form), and
run a procedure that will display the two digit number as the day value in
short date format. The month and year would come from the current computer
date value. ie.. I enter 02 the display value= 04/02/04. Next problem, if I
enter 0502 the display value should be = 05/02/04.
Sure, you'll need to write a little code in the control's after update
event. Here's some untested (aircode) that might do it for you. Watch out
for line wrap:
Sub txtMyDate_AfterUpdate()
Select Case Len(Me.txtMyDate)
Case 2
Me.txtMyDate = Format(Month(Date) & "/" & Me.txtMyDate & "/" &
Year(Date), "mm/dd/yy")
Case 4
Me.txtMyDate = Format(Left(Me.txtMyDate,2) & "/" &
Right(Me.txtMyDate,2) & "/" & Year(Date), "mm/dd/yy")
Case 6
Me.txtMyDate = Format(Left(Me.txtMyDate,2) & "/"
Mid(Me.txtMyDate,2,2) & "/" & Right(Me.txtMyDate,2), "mm/dd/yy")
Case Else
MsgBox "Invalid Entry", vbOKOnly, "Wake Up!"
End Select
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access