sort report by Time (HH.mm), when in database time column is type of Text
I have to sort report table by column where times in Access database are entered as Text. There is a problem because my times are ordered as text, like 10.30, 11.20, 23.40, 7.10, 9.25, and I like them to be ordered from morning to midnight (7.10, 9.25, 10.30, 11.20, 23.40). I'd like to know if it's possible to sort report in correct way without changing column type in database.

Nisam JaPosted Oct 10, 2010, 4:05 AM
I've tried this, but it didn't worked (there is an error):
OleDb.OleDbConnection myCon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\myDb.mdb");
DataTable tb = voznjaDataSet.Tables["myTable"];
tb.Columns.Add("newField");
string dbcommand = "UPDATE myTable SET newField = (timeField.ToDateTime("HH.mm"))"; //timeField is type of string
da = new OleDbDataAdapter(dbcommand, myCon);
da.Fill(myDataSet);
Sam HobbsPosted Oct 10, 2010, 3:06 AM
You might get more help with SQL in DB Talks.
Nisam JaPosted Oct 10, 2010, 2:34 AM
Sam HobbsPosted Oct 9, 2010, 9:01 PM
You probably can use a SQL statement that creates a date field from the date string and then sort on that and you don't need to show that field in the report. I don't know if htere is a function you can call in SQL to convert to a date from a string but I assume there is.