Modify DD element of a Short Date - How?

G

Glynn Taylor

I have a Short Date field 'DateActual'
and need to copy it to Short Date field 'DateFirstofMonth' changing the DD
element to '01'
How is this done?
Thank you.
 
D

Dennis

DateFirstofMonth = CDate("01/" & Month([DateActual]) & "/" &
Year([DateActual]))
 
G

Glynn Taylor

Hello Dennis

Thank you for your prompt response - much appreciated.

Glynn

Dennis said:
DateFirstofMonth = CDate("01/" & Month([DateActual]) & "/" &
Year([DateActual]))

Glynn Taylor said:
I have a Short Date field 'DateActual'
and need to copy it to Short Date field 'DateFirstofMonth' changing the DD
element to '01'
How is this done?
Thank you.
 
D

Douglas J Steele

NOTE: That will only work for users whose ShortDate format has been set to
dd/mm/yyyy through regional settings. Otherwise, you'll be getting 09 Jan,
2005 if DateActual is a date in September of this year.

Far more reliable is DateFirstofMonth = DateSerial(Year([DateActual]),
Month([DateActual], 1)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dennis said:
DateFirstofMonth = CDate("01/" & Month([DateActual]) & "/" &
Year([DateActual]))

Glynn Taylor said:
I have a Short Date field 'DateActual'
and need to copy it to Short Date field 'DateFirstofMonth' changing the DD
element to '01'
How is this done?
Thank you.
 
Top