Setting date format for list box
I am retrieving data into a list box from an Access database with,
essentially, the following code
:
Dim dbReports As DAO.Recordset
Dim avRows As Variant
:
Set dbReports = gdbEmissions.OpenRecordset(sQuery)
'update list box
With Me.lbxSite
.Clear
If dbReports.RecordCount 0 Then
avRows = dbReports.GetRows(mlNumRecords)
.List = Application.WorksheetFunction.Transpose(avRows)
End If
.ListIndex = -1
End With
:
Five columns of data are shown, including one column that contains date data.
Everything is fine EXCEPT that the date format is dependent upon how the
display form is run.
If I start with a front-end form that calls the display form, then the date
format is MM/DD/YYYY, contrary to the regional setting
If I start the display form from within the VBA environment then the date
format is DD/MM/YYYY - which is the desired format, and also the regional
setting
Why is there a difference, and can I force Excel to use the regional setting ?
Regards
Kevin Beckham
|