Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to detect uniqueID with textbox class
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
How to detect uniqueID with textbox class
Miscellaneous
Thread ID:
00845874
Message ID:
00845874
Views:
55
Hi All,
i have a textbox class and i wantto detect with it uniqueID's parametric . eg. if it controlsource is StockID ,lostfocus or validevent will detect entered value and if exist on the table will warn the user and will not give right for save or edit . with this target i've created a textbox class.

it has some properties
lcTable (none)
lcIndex (none)
LcUniq .f.

* methods

*interactiveChangeEvent code
sends _vfp.activeform.changed=.t. if changed something on it

* valid event code
If This.lcuniq 
	Set Exact On
	Set Near Off

	Private lcalias
	lcalias=Alias()
	Private lnrecno
	lnrecno=0
	lnrecno=Recno()
	Use (This.lctable) Again In 0 Alias loctable Order Tag (This.lcindex)
	lcvalue = Alltrim(This.Value)
	lcindex = This.lcindex
	lctable = "loctable"
	If !Empty(lcvalue) And !Empty(lcindex) And !Empty(lctable)
		If Seek(lcvalue, lctable, lcindex)
			Messagebox('Code AllReady Exist',16,'Opps',2)
			this.SetFocus
		Else
			Messagebox('New&Edit Possible',64,'Onay',1)
		Endif
	Endif
	If Used('loctable')
		Use In loctable
	Endif
	If !Empty(lcalias)
		If Alltrim(Upper(Alias()))<>Alltrim(Upper(lcalias))
			Select (lcalias)
			If lnrecno>0 And Recno()<>lnrecno
				Goto lnrecno
			Endif
		Endif
	Endif
Endif
it works but every time warnings . which is the best way for detecting UniqID's for this situations ?

PS : Index is regular

TIA
Next
Reply
Map
View

Click here to load this message in the networking platform