[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

MSHflexgrid date format problem

Posted on 2003-03-18
5
Medium Priority
?
571 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
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

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

611 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