Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Valid Event in a TextBox
Message
 
To
22/01/1999 14:31:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00179019
Message ID:
00179187
Views:
29
Jim,

As a general rule, this is a bad thing to do. In a multi-user environment this approach will prevent others from adding records while a transaction is open. Transactions should really be used along with buffering and kept open for a minimal amount of time.

That said, with no buffering how are you determining whether the record is new and needs to be validated? It would seem to me that the locate would always find a match unless the textbox is not bound to the table.

I would reccomend you switch to a buffered environment. Below is an approach to validation that will not move the record pointer off the record currently being added:
lFound = .F.
if [it's a new new_record ] && How you determine depends on buffering mode

	select count(id_no) as NumberFound from drawing ;
		where drawing.id_no == this.value into cursor tValid

	lFound = tValid.NumberFound > 0

	if lFound
		=MessageBox(drawing.id_no+' already exists!')
	endif

	use in tValid

endif

return ! lFound
I hope this helps.

>Hi again,
>
>BTW. it's in a TRANSACTION and buffering still is none.
>
>>What type of buffering are you using? I'll try to reproduce the problem and see if I can get it figured out for you.
kenweber
GCom2 Solutions
Microsoft Certified Professional

Previous
Reply
Map
View

Click here to load this message in the networking platform