I have created MS Access Database using C# ADOX library. I have created one table with several columns. What I want to achieve is when I insert date in one column, the date format should be YYYY-MM-DD and not MM-DD-YYYY. I know its just display format, but I want to access the property which we set when we open access table in design mode, and for column with date data type, set format as Custom (YYYY-MM-DD). I want this to be set at runtime while creating table only. I wanted to know what should be property name that I should use in order to access and set the format property of column?
Asked
Active
Viewed 2,537 times
0
-
1If the MDB is not being used by Access, then it's a waste of time to set the format property, I think, because it's really only honored by Access. I could be wrong on that, though. – David-W-Fenton Jul 21 '09 at 00:56
-
@David W. Fenton: I think you are spot on. – onedaywhen Jul 21 '09 at 05:42
1 Answers
-1
You will be better of using DAO library to do that, if you are targetting only Access DB
With DAO, you could open the database, recordset & access this property using Columns(colNumber).Properties("Format").
If you don't know, how to use DAO - let me know.
EDIT: VB6 code using DAO to get the Format property
Dim db As DAO.Database, rst As DAO.Recordset
Set db = OpenDatabase("Path to my MDB file")
Set rst = db.OpenRecordset("select myDateColumn From myTable WHERE 1 = 2")
MsgBox rst.Fields("myDate").Properties("Format").Value
rst.Close
Set rst = Nothing
db.Close
Set db = Nothing

shahkalpesh
- 33,172
- 3
- 63
- 88