PDA

View Full Version : Microsoft Acess Date format



28-04-2002, 02:13 PM
Does anyone know how to set up a date in access where you only have to enter the day ie 5 and it will return the the date for the current month, ie 5/04/2002.
Lotus approach allows this but cannot get Acess to do it. Would apreciate any advice

28-04-2002, 10:49 PM
If you are using a form, you can use something like this: An unbound control accepts the input which is then converted to a date. The unbound control is then updated (using the AfterUpdate event) in a date format (of course you could direct the formatted output to a bound control. No bounds or error checking in this simplistic example!

Private Sub UnboundDate_AfterUpdate()
Dim ConstructedDate As Date
ConstructedDate = DateSerial(Year(Now), Month(Now), Me![UnboundDate])
Me![UnboundDate] = Format(ConstructedDate, 'dd/mm/yyyy')
End Sub