Hello All,
I am not having any luck researching a specific issue and have tried so many different tutorials, but I am still unable to get the results I want.
Problem:
I have a userform with a listbox that is tied to a double click event. When you double click the record returned from a search the data populates user controls for editing. I have two text boxes for date fields mm/dd/yyyy. When I search I see the correct dates, after calling the data I get the MS date code instead of the desired format. I have used both the "before and after update," on exit, and on initialize. I have tried both "cdate and format" as well, but the data still appears in the textbox in MS date format upon double clicking the desired record to load. You can type over the MS format or just space bar on the end of the code and tab off, the date will convert to the correct format. How do I get the date to call as a date format, rather than as a MS format?
I am not having any luck researching a specific issue and have tried so many different tutorials, but I am still unable to get the results I want.
Problem:
I have a userform with a listbox that is tied to a double click event. When you double click the record returned from a search the data populates user controls for editing. I have two text boxes for date fields mm/dd/yyyy. When I search I see the correct dates, after calling the data I get the MS date code instead of the desired format. I have used both the "before and after update," on exit, and on initialize. I have tried both "cdate and format" as well, but the data still appears in the textbox in MS date format upon double clicking the desired record to load. You can type over the MS format or just space bar on the end of the code and tab off, the date will convert to the correct format. How do I get the date to call as a date format, rather than as a MS format?
VBA Code:
Private Sub Emp27_AfterUpdate()
On Error Resume Next
Me.Emp27.Value = Format(Me.Emp27, "mm/dd/yy")
End Sub
Private Sub Emp28_AfterUpdate()
On Error Resume Next
Me.Emp28.Value = Format(Me.Emp28, "mm/dd/yy")
End Sub
Private Sub Userform_Initialize()
Me.Emp28.Value = Format(Me.Emp28, "mm/dd/yy")
Me.Emp27.Value = Format(Me.Emp27, "mm/dd/yy")
Me.lstEmp.RowSource = ""
End Sub