myname26 Posted April 19, 2003 Posted April 19, 2003 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 Quote
*Experts* jfackler Posted April 19, 2003 *Experts* Posted April 19, 2003 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. Quote
Moderators Robby Posted April 19, 2003 Moderators Posted April 19, 2003 I think your formatting should be done in the SQL statement you used to pull the original command. Quote Visit...Bassic Software
hog Posted April 20, 2003 Posted April 20, 2003 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. Quote My website
myname26 Posted April 20, 2003 Author Posted April 20, 2003 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 !! Quote
Moderators Robby Posted April 20, 2003 Moderators Posted April 20, 2003 As I stated in my previous post, do your formatting in your SQL... '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' Quote Visit...Bassic Software
hog Posted April 20, 2003 Posted April 20, 2003 Mmm good observation Robby, I'll keep that one in mind :-) Quote My website
myname26 Posted April 20, 2003 Author Posted April 20, 2003 still no good with MS SQL!! Please help still no good with MS SQL!! Please help Quote
*Experts* jfackler Posted April 20, 2003 *Experts* Posted April 20, 2003 myname26, Take a look here: specifically addresses mysql, access, sql server and some others. http://sqlzoo.net/howto/sqlservertip734148.htm Seems the syntax needs to be datepart. Jon Quote
Moderators Robby Posted April 21, 2003 Moderators Posted April 21, 2003 myname26: did you not say that this was in Access? If you're using SQL Server then you need to use DatePart(). Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.