Display database collumn of Date type in combobox

myname26

Newcomer
Joined
Apr 19, 2003
Messages
3
This is what im trying to acheive

ComboBox.DataSource = ds.Tables(0)
ComboBox.DisplayMember = Format("CollumnName", "dd/MM/yyyy")
ContractDate.SelectedIndex = -1

where collumnname is of time date/time in access.


i want to display just the date and not the time
 
I may be corrected by anyone but I think your combobox.displaymember will be a string.

You'll need to convert it to date first, then do the format.
 
Just set the format of the field in your Access database table to short date format and no further work will be required by you.
 
sorry i did not work

i already had it to short date. the problem is im getting it correctly from the sql statement . combobox does a ToString and that is when time is added. so... pls help !!
 
As I stated in my previous post, do your formatting in your SQL...
Visual Basic:
'FieldDate being your column name in the table

"SELECT FieldOne, Fieldtwo, Format(DateValue([FieldDate]),"dd/mm/yyyy") AS myDate FROM myTable"

Hog - The problem with setting as ShortDate at the table level is that the format would change depending on the OS culture settings. Some countries are 'dd/mm/yy' others 'mm/dd/yy'
 
Back
Top