Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Right Recno()
Message
From
02/11/1999 18:12:07
 
 
To
02/11/1999 16:28:16
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00285239
Message ID:
00285819
Views:
18
Hi Joao,

>I get the fowling error in the valid event,
>'No database is open or set as the current database' in the line
> lcPrimaryKey = dbgetprop........ and then
>'variable lcPrimaryKey does not exist'

That means your database isn't open. Do you have a main data base for the application? Is this table apart of the database, and does this table have a primary index? If so, you need to open the database sometime before this happens. I usually open it up at the beginning of my app (OPEN DATABASE is the code) Other wise, use this (this uses the Recno() instead of a primary Key):
local lnCurWA, llReturn, lcExact, leValue, lnRecno()

with This
	lnCurWA = select()
	lcExact = set('exact')
	set exact on
	lnRecno = recno(juststem(.ControlSource))

	use (dbf(juststem(.ControlSource))) again alias EnforceUnique in 0
	select EnforceUnique

	llReturn = !seek(.Value, 'enforceunique', justext(.ControlSource)) or Recno() = lnRecno

	use
	select (lnCurWA)
	set exact &lcExact

endwith
if !llreturn
	MessageB('Value is not unique')
endif
return iif(llReturn, .T., 0)
Does this work?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform