In case of character input:
you can do it this way:
if len(alltrim(thisform.txtfrdate.value))<len(alltrim(thisform.txtdate.value))
messagebox(....)
endif
Put this code in lost focus property of yours textboxes
In case of date input
if thisform.txtfrdate.value<thisform.txtdate.value
messagebox(....)
endif
The user can enter txtfrdate and txttodate
The user can enter txtfrdate only
The user can enter txttodate only
The user need not enter on both..
So the way to go is..
In the Forms Init event..
ThisForm.txtfrdate.Value = DATE()
ThisForm.txttodate.Value = DATE()
In the LostFocus of
ThisForm.txtfrdate
IF ThisForm.txtfrdate.Value > ThisForm.txttodate.Value
ThisForm.txttodate.Value = ThisForm.txtfrdate.Value
ENDIF
In the LostFocus of
ThisForm.txttodate
IF ThisForm.txttodate.Value < ThisForm.txtfrdate.Value
** either
ThisForm.txttodate.Value = ThisForm.txtfrdate.Value
NODEFAUT
** OR
=MESSAGEBOX("UnAcceptable Date value",0+16)
NODEFAULT
ENDIF
You can also force validation and set focus back, just before you start your report or before data update.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.