CHECK DATE STRING

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

CHECK DATE STRING

Post by sal21 »

If Me.CFINE1.Text > Me.CINIZIO1.Text Then stop

in CFINE1 have "03/2014"
in CINIZIO1 have "03/2026"

why the if condition does not give errors!?

User avatar
HansV
Administrator
Posts: 78233
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: CHECK DATE STRING

Post by HansV »

"03/2014 is less than "03/2026".
But if CFINE1 = "12/2014" and CINIZIO1 = "03/2021", CFINE1 is larger than CINIZIO1, since you are comparing strings, not dates.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: CHECK DATE STRING

Post by sal21 »

HansV wrote:
27 Apr 2021, 11:20
"03/2014 is less than "03/2026".
But if CFINE1 = "12/2014" and CINIZIO1 = "03/2021", CFINE1 is larger than CINIZIO1, since you are comparing strings, not dates.
i need to check exactly the opposite, sorry.

If Me.CINIZIO1.Text > Me.CFINE1 .Text Then stop

and i need to check the two date string

User avatar
HansV
Administrator
Posts: 78233
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: CHECK DATE STRING

Post by HansV »

You can see in my code in FILL combobox by combobox how to compare strings such as "03/2014" as dates.
Best wishes,
Hans