Default Date format issue when passing value from previous to current record

Ray Spackman

Registered User.
Local time
Yesterday, 17:24
Joined
Feb 28, 2008
Messages
52
Okay, so I have continuous form that has a DueDate (date data type, formatted to medium date) control and a Completed (date data type, formatted to medium date) control. I am tryping to pass Completed.Value from the previous record to the DueDate.DefaultValue of the current record using an AfterUpdate event for Completed. Code I am using is such:

Private Sub Completed_AfterUpdate()
Me.DueDate.DefaultValue = Me.Completed.Value
End Sub

Problem: Originally a date value was being passed from Completed from previous record to DueDate in current record, but the date was not current and was 12/31/1899. After trying some things, I lost the date format and the DueDate.DefaultValue is showing a time format.

I need to get this fixed and eventually have Completed.Value (adding a certain number of weeks which will retrieved from a control on another form) to the DueDate.DefaultValue and show the correct date format while doing so.

Thank You in advance.
 
Try:-

Code:
 Private Sub Completed_AfterUpdate()
    Dim intNumWeeksToAdd As Integer
    
    intNumWeeksToAdd = 4
 
    Me.DueDate.DefaultValue = Chr(34) & DateAdd("ww", intNumWeeksToAdd, Me.Completed) & Chr(34)

End Sub

Chris.
 
Thanx Chris. Worked perfectly. :)
 

Users who are viewing this thread

Back
Top Bottom