ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting date format for list box (https://www.excelbanter.com/excel-programming/423225-setting-date-format-list-box.html)

Kevin Beckham[_3_]

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


All times are GMT +1. The time now is 03:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com