Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Textbox with Control Source Problem ??
Message
 
To
27/01/2005 22:53:57
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows '98
Network:
SAMBA Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00981597
Message ID:
00981805
Views:
36
Leo Here how I resolve this problem:
In GotFocus event of the TextBox:
** GotFocus
thisform.old_value = this.Value

** In Valid Event
LOCAL ret_val, m_rec
ret_val = .t.
IF LastKey() # 27 && if the user press Esc
   IF thisform.old_value # this.Value
      SELECT MyTable
      old_record = RecNo()
      SEEK this.Value  && To Move the pointer
      GOTO old_record
   ENDIF  
ENDIF
RETURN ret_val

*** In Error event of the TextBox
  LPARAMETERS nError, cMethod, nLine
  IF nError = 1884 && Uniqueness is violated
     MessageBox("Record with this value already exiists",0,"Warning")
     this.Value = thisform.old_value
  ENDIF
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform