L
LotusEater
I have a button for "go to next record" on a form. I want to assign the
current value chosen in a date combo box as the default value before moving
to the next record.
I am using the code below:
Private Sub cmdNextRecord_Click()
Me!combo_date.DefaultValue = Me!combo_date.Value
On Error GoTo Err_cmdNextRecord_Click
DoCmd.GoToRecord , , acNext
Exit_cmdNextRecord_Click:
Exit Sub
Err_cmdNextRecord_Click:
MsgBox Err.Description
Resume Exit_cmdNextRecord_Click
End Sub
It will assign the date of 12/30/1899 for the next record. I put a
breakpoint in the VBA code to see what the values were after this step.
Me!combo_date.Value
Value = 7/30/2009
Type = Variant/Date
Me!combo_date.DefaultValue
Value = "7/30/2009"
Type = Variant/String
I have tried wrapping the statement in numerous date commands such as
DateValue() and CDate() to keep it from converting to a string.
Any ideas?
current value chosen in a date combo box as the default value before moving
to the next record.
I am using the code below:
Private Sub cmdNextRecord_Click()
Me!combo_date.DefaultValue = Me!combo_date.Value
On Error GoTo Err_cmdNextRecord_Click
DoCmd.GoToRecord , , acNext
Exit_cmdNextRecord_Click:
Exit Sub
Err_cmdNextRecord_Click:
MsgBox Err.Description
Resume Exit_cmdNextRecord_Click
End Sub
It will assign the date of 12/30/1899 for the next record. I put a
breakpoint in the VBA code to see what the values were after this step.
Me!combo_date.Value
Value = 7/30/2009
Type = Variant/Date
Me!combo_date.DefaultValue
Value = "7/30/2009"
Type = Variant/String
I have tried wrapping the statement in numerous date commands such as
DateValue() and CDate() to keep it from converting to a string.
Any ideas?