?
Solved

MSHflexgrid date format problem

Posted on 2003-03-18
5
Medium Priority
?
550 Views
Last Modified: 2013-12-26
I am using ADO to access MSAccess and/or mysql and create a recordset. When I link the MSHflexgrid datacontrol to the recordset the date format is US style (my settings are European). I can use a format statement in the select SQL (e.g. "SELECT format(p.mydate,'dd/mm/yyyy') as mydate from table p") which solves the display problem in the grid.
However when I do that the field is not recognized as a date any longer so any .sort and .filter actions result in numericly sorted rows...

Does anybody have a solution for this?

0
Comment
Question by:J_code
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 11

Expert Comment

by:supunr
ID: 8163737
Y not write a custom sort for flexgrid.

Private Sub MSFlexGrid1_Compare(ByVal Row1 As Long, ByVal Row2 As Long, Cmp As Integer)
    With MSFlexGrid1
        Col = 2 ' date column
        If (CDate(.TextMatrix(Row1, Col)) < CDate(.TextMatrix(Row2, Col))) Then
            Cmp = -1
        ElseIf (CDate(.TextMatrix(Row1, Col)) = CDate(.TextMatrix(Row2, Col))) Then
            Cmp = 0
        Else
            Cmp = 1
        End If
    End With
End Sub

Good Luck!
0
 

Author Comment

by:J_code
ID: 8165769
thanx supunr,
this does solve the sorting problem, but not the filter:
eg. recordset.filter "date_received > #12/03/2003#"

Because of the format() the field in the recorset is not a date (same goes for formatted numbers). So my best solution is if the dates and numbers can be formatted in the MSHflexgrid (not in the recordset).
Is that in any way possible?
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9053317
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->PAQ - with points refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0
 

Author Comment

by:J_code
ID: 9066186
PAQ
0
 

Accepted Solution

by:
YensidMod earned 0 total points
ID: 9143696
Question is PAQ'd and points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question