Steve:
A couple of points:
1. The property is the DefaultValue property, not the Default property,
which is something different.
2. The DefaultValue property is always a string expression regardless of
the data type so should be wrapped in quotes characters. This is especially
important with dates as otherwise the 'date' can be interpreted as an
arithmetical expression and give the wrong result.
So, putting both together gives:
Me!MyDate.DefaultValue = """" & Me!MyDate & """"
BTW don't be tempted to use the # date delimiter character in place of the
literal quotes. This is internationally unreliable as it requires the date
to be in US short date or an otherwise internationally unambiguous format.
You can handle this sort of thing generically by adding a function along
these lines to a standard module:
Public Function SetDefaultValue(ctrl As Control)
If Not IsNull(ctrl) Then
ctrl.DefaultValue = """" & ctrl & """"
End If
End Function
The function can then be called as the AfterUpdate event property of any
control which supports the Defaultvalue property like so:
=SetDefaultValue([Form].[ActiveControl])
Note the use of the Form property to reference the current form here. This
can be used in the properties sheet whereas Me can only be used in VBA.
Ken Sheridan
Stafford, England