R
RB Smissaert
In Excel VBA I am showing a variant array in an Access table.
All working nicely, except when there is a date column
with empty dates these empty dates will show in Access as
30/12/1899.
The format of this date field is set like this:
'doing dbText is better for the rows with a value as
'it will maintain the exact date format, but when there
'is no value you will get 30/12/1899, now it will be 00:00:00
'------------------------------------------------------------
SetPropertyDAO tdfNew.Fields(arrDateFormat(c)), _
"Format", _
dbDate, _
strDateFormat
strDateFormat is a string holding for example "dd/mmm/yyyy"
The table is setup like this (code snippet only):
'First, create the database.
Set dB1 = DBEngine.CreateDatabase(strAccessFile, dbLangGeneral)
'Create a new TableDef object.
Set tdfNew = dB1.CreateTableDef(strSheetName)
With tdfNew
' Create fields and append them to the new TableDef
' object. This must be done before appending the
' TableDef object to the TableDefs collection database.
.Fields.Append .CreateField(strField, dbDate)
How do I avoid this and at the same time format the non-empty dates?
RBS
All working nicely, except when there is a date column
with empty dates these empty dates will show in Access as
30/12/1899.
The format of this date field is set like this:
'doing dbText is better for the rows with a value as
'it will maintain the exact date format, but when there
'is no value you will get 30/12/1899, now it will be 00:00:00
'------------------------------------------------------------
SetPropertyDAO tdfNew.Fields(arrDateFormat(c)), _
"Format", _
dbDate, _
strDateFormat
strDateFormat is a string holding for example "dd/mmm/yyyy"
The table is setup like this (code snippet only):
'First, create the database.
Set dB1 = DBEngine.CreateDatabase(strAccessFile, dbLangGeneral)
'Create a new TableDef object.
Set tdfNew = dB1.CreateTableDef(strSheetName)
With tdfNew
' Create fields and append them to the new TableDef
' object. This must be done before appending the
' TableDef object to the TableDefs collection database.
.Fields.Append .CreateField(strField, dbDate)
How do I avoid this and at the same time format the non-empty dates?
RBS