Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why do I have nesting error on EXIT command line?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Why do I have nesting error on EXIT command line?
Miscellaneous
Thread ID:
00737410
Message ID:
00737410
Views:
66
I get a nesting error when I run this code. It happens on the EXIT command near the bottom. I don't see why? Do you? Thanks!

Here is my code:
* Establish the Master record ID
USE \DATA\REGISTRY\IDMASTER IN 0 SHARE
SELECT IDMASTER
SET ORDER TO DB_NAME
SEEK "MASTER"
IF FOUND()
	IF YEAR(DATE())=IDMASTER.YEAR
	   REPLACE IDMASTER.ID_NUM WITH IDMASTER.ID_NUM+1
	   REPLACE IDMASTER.DATE WITH DATE()
	   NEW_ID="MA"+ALLTRIM(STR(YEAR(DATE())))+"-"+PADL(ALLTRIM(STR(IDMASTER.ID_NUM)),5,"0")
	  ELSE
	   REPLACE IDMASTER.YEAR WITH YEAR(DATE())
	   REPLACE IDMASTER.ID_NUM WITH 1
	   REPLACE IDMASTER.DATE WITH DATE()
	   NEW_ID="MA"+ALLTRIM(STR(YEAR(DATE())))+"-"+PADL(ALLTRIM(STR(IDMASTER.ID_NUM)),5,"0")
	ENDIF
ELSE
	MESSAGEBOX("MASTER not found in ID Master database. "+;
		"Master ID created using alternative method. "+;
		"Note this error and forward it to a computer tech.",0+64,"Master Journal")
	SELECT master			
	GO BOTTOM 							
	indx = ALLT(RIGHTC(master.mast_id,5))
	IF indx = NULL
		indx = 0
	ENDIF
	SET DECIMALS TO 0
	indux = VAL(indx)
	indux = indux + 1	&& Add 1 to Master ID
	NEW_ID="MA"+ALLTRIM(STR(YEAR(DATE())))+"-"+PADL(ALLTRIM(STR(indux)),5,"0")
	SELECT idmaster
	EXIT
ENDIF
USE
SELECT MASTER

isedit = .T.
* Append Master record
APPEND BLANK
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Next
Reply
Map
View

Click here to load this message in the networking platform