The following is a 'snippet' of code, from a longer routine, which should load the day, month and year respectively, into 3 combo boxes ( the date in question, is derived from a date field - DOB - forming one field of the form's recordset - Client's details basically ).
... as you can probably see, it separates out these parts d,m,y into 3 string variables, and then outputs to the relevant combo boxes. It does not output ANYTHING at the moment to the year box, and the other two ( day and month ) produce sometimes correct, sometimes incorrect, results. Any helpful thoughts, appreciated.
Code:
Dim d, m, y As String
Dim dtdob As Date
With Me.Recordset
dtdob = !DOB
d = CStr(DatePart("d", dtdob))
m = CStr(DatePart("m", dtdob))
y = CStr(DatePart("yyyy", dtdob))
End With
Me.cboDay.Value = d
Me.cboMonth.Value = m
Me.cboYear.Value = y
... as you can probably see, it separates out these parts d,m,y into 3 string variables, and then outputs to the relevant combo boxes. It does not output ANYTHING at the moment to the year box, and the other two ( day and month ) produce sometimes correct, sometimes incorrect, results. Any helpful thoughts, appreciated.
Last edited: