Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Display a date from a datetime?
Message
From
01/12/2004 14:25:27
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00965996
Message ID:
00966164
Views:
23
This message has been marked as the solution to the initial question of the thread.
In the updatecontrolsource method, I have placed the following code :-
LOCAL ldValue, lcField, lcAlias

ldValue = IIF( VARTYPE( This.Value ) = 'T', TTOD( This.Value ), This.Value )
lcField = JUSTEXT( This.cControlSource )
lcAlias = JUSTSTEM( This.cControlSource )

*** Update cControlSource from the Control's Value
IF NOT EMPTY( This.cControlSource )
  IF EMPTY( NVL( ldValue, {} ) )
    *** Check to see if we are updating a form property
    IF UPPER( LEFT( This.cControlSource, 4 ) ) == 'THIS'
      lcControlSource = This.cControlSource 
      &lcControlSource = {/:}
    ELSE
      REPLACE ( lcField ) WITH .NULL. IN ( lcAlias )
    ENDIF
  ELSE
    *** make sure we have a valid date
    *** so we do not get datetime overflow errors 
    *** in sql server when we attempt an update
    IF NOT( UPPER( LEFT( This.cControlSource, 4 ) ) == 'THIS'	)
      IF BETWEEN( ldValue, {^1900-01-01}, {^3000-01-01} )
  	REPLACE ( lcField ) WITH DTOT( ldValue ) IN ( lcAlias )
      ELSE
        MESSAGEBOX( 'Invalid Date', 16, 'Please Fix Your Input' )
	RETURN .F.
      ENDIF		
    ELSE
      lcControlSource = This.cControlSource 
      &lcControlSource = DTOT( ldValue )
    ENDIF
  ENDIF
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform