Home » Developer & Programmer » Forms » FRM-40102 record must be entered or deleted first (Forms11g)
icon5.gif  FRM-40102 record must be entered or deleted first [message #659742] Sat, 28 January 2017 23:53 Go to next message
MGhobashi27
Messages: 3
Registered: January 2017
Location: Kuwait
Junior Member

Dear All,
I'm using oracle forms 11g and i'm developing a form with 2 blocks to compare data between them,i want to show on the block only the records that matches , i've written the following code in
WHEN-NEW-BLOCK-INSTANCE and i'm getting FRM-40102 record must be entered or deleted first Embarassed

Here's my code :

CLEAR_BLOCK(NO_VALIDATE);
IF :PMP_MANAG.LICN_CIVIL_NO IS NOT NULL THEN 
	:PMP_MANAG.LICN_CENT_NAME:=SAL_EMPLOYEE_DATA.GET_EMP_NAME(:PMP_MANAG.LICN_CIVIL_NO); 
END IF;

DECLARE 
	CURSOR LICN_REQ_CUR IS
   SELECT DISTINCT A.LICN_REQ_RECID,A.ACTV_PURPOSE_RECID
    FROM PMP_EXTRA_PURPOSE A
    WHERE A.LICN_REQ_RECID IN (
    SELECT DISTINCT R.LICN_REQ_RECID
    FROM PMP_COMPANY_OWNERS O, PMP_LICN_REQ R
    WHERE O.LICN_REQ_RECID = R.LICN_REQ_RECID
    AND O.MANAGER = 1
    AND NVL(o.EXP_MGR_ACT,0) <> 1 
    AND NVL (O.IS_ACTIVE, 0) = 1
    AND O.OWNER_CIVIL_ID = :PMP_MANAG.LICN_CIVIL_NO)
    AND  ACTV_PURPOSE_RECID IN (SELECT ACTV_PURPOSE_RECID
    FROM PMP_EXTRA_PURPOSE_T
    WHERE LICN_REQ_RECID=:PMP_LICN_REQ.LICN_REQ_RECID)
UNION
    SELECT DISTINCT A.LICN_REQ_RECID,A.ACTIVITY_PUR_RECID
    FROM PMP_LICN_REQ A
    WHERE A.LICN_REQ_RECID IN (
    SELECT DISTINCT R.LICN_REQ_RECID
    FROM PMP_COMPANY_OWNERS O, PMP_LICN_REQ R
    WHERE O.LICN_REQ_RECID = R.LICN_REQ_RECID
    AND O.MANAGER = 1
    AND NVL(O.EXP_MGR_ACT,0) <> 1 
    AND NVL (O.IS_ACTIVE, 0) = 1
    AND O.OWNER_CIVIL_ID = :PMP_MANAG.LICN_CIVIL_NO
    )AND ACTIVITY_PUR_RECID IS NOT NULL;
    
V_LICN_REQ LICN_REQ_CUR%ROWTYPE;	
BEGIN

OPEN  LICN_REQ_CUR;
FIRST_RECORD;
LOOP
	FETCH LICN_REQ_CUR INTO :PMP_MANAG.LICN_REQ_RECID,:PMP_MANAG.ACTIVITY_PUR_RECID;
	EXIT WHEN LICN_REQ_CUR%NOTFOUND;
	GO_BLOCK('PMP_EXTRA_PURPOSE');
	FIRST_RECORD;
LOOP
HIDE_VIEW('EXTRA_PUS_CAN');
hide_window('EXTRA_PURPOSE_WIN');
GO_BLOCK('PMP_MANAG');						
		IF :PMP_MANAG.ACTIVITY_PUR_RECID=:PMP_EXTRA_PURPOSE.ACTV_PURPOSE_RECID THEN	
				:PMP_MANAG.COMPANY_NAME:=EST_GET_DATA.GET_COMPANY_NAME_PARENT(:PMP_MANAG.LICN_REQ_RECID);
				:PMP_MANAG.LICN_CENTRAL_NO:=EST_GET_DATA.GET_LICN_CENTRAL_NO(:PMP_MANAG.LICN_REQ_RECID);
				:PMP_MANAG.DATE:=SYSDATE;
			NEXT_RECORD;
		ELSIF :PMP_MANAG.ACTIVITY_PUR_RECID <> :PMP_EXTRA_PURPOSE.ACTV_PURPOSE_RECID THEN		
                        DELETE_RECORD;     
		END IF;
		
		EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
			NEXT_RECORD;
		END LOOP;	
					
NEXT_RECORD;
END LOOP;
	
FIRST_RECORD;
CLOSE LICN_REQ_CUR;
END;

Re: FRM-40102 record must be entered or deleted first [message #659743 is a reply to message #659742] Sun, 29 January 2017 02:10 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 561
Registered: August 2002
Senior Member
Check the Constraint at form level . have you describe accurately??
Re: FRM-40102 record must be entered or deleted first [message #659744 is a reply to message #659743] Sun, 29 January 2017 02:19 Go to previous messageGo to next message
MGhobashi27
Messages: 3
Registered: January 2017
Location: Kuwait
Junior Member

sorry i cant understand your question !! what do you mean by the form constraints ??
Re: FRM-40102 record must be entered or deleted first [message #659746 is a reply to message #659744] Sun, 29 January 2017 04:15 Go to previous messageGo to next message
Littlefoot
Messages: 21561
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Wouldn't it be simpler to create a master-detail form? Block A would be the master; while creating the relationship, you'd join all relevant columns (from a block B, a detail block) which you use to decide whether they match or not. Doing so, you'd avoid all that code, Forms does everything for you; you'd just have to follow the wizard.
Re: FRM-40102 record must be entered or deleted first [message #659747 is a reply to message #659742] Sun, 29 January 2017 04:52 Go to previous messageGo to next message
MGhobashi27
Messages: 3
Registered: January 2017
Location: Kuwait
Junior Member

Littlefoot, sadly no, block B is not a database block..

Well, i've solved it this way ..

CLEAR_BLOCK(NO_VALIDATE);
IF :PMP_MANAG.LICN_CIVIL_NO IS NOT NULL THEN 
	:PMP_MANAG.LICN_CENT_NAME:=SAL_EMPLOYEE_DATA.GET_EMP_NAME(:PMP_MANAG.LICN_CIVIL_NO); 
END IF;
DECLARE 
	CURSOR LICN_REQ_CUR IS
   SELECT DISTINCT A.LICN_REQ_RECID,A.ACTV_PURPOSE_RECID
    FROM PMP_EXTRA_PURPOSE A
    WHERE A.LICN_REQ_RECID IN (
    SELECT DISTINCT R.LICN_REQ_RECID
    FROM PMP_COMPANY_OWNERS O, PMP_LICN_REQ R
    WHERE O.LICN_REQ_RECID = R.LICN_REQ_RECID
    AND O.MANAGER = 1
    AND NVL(o.EXP_MGR_ACT,0) <> 1 
    AND NVL (O.IS_ACTIVE, 0) = 1
    AND O.OWNER_CIVIL_ID = :PMP_MANAG.LICN_CIVIL_NO)
    AND  ACTV_PURPOSE_RECID IN (SELECT ACTV_PURPOSE_RECID
    FROM PMP_EXTRA_PURPOSE_T
    WHERE LICN_REQ_RECID=:PMP_LICN_REQ.LICN_REQ_RECID)
UNION
    SELECT DISTINCT A.LICN_REQ_RECID,A.ACTIVITY_PUR_RECID
    FROM PMP_LICN_REQ A
    WHERE A.LICN_REQ_RECID IN (
    SELECT DISTINCT R.LICN_REQ_RECID
    FROM PMP_COMPANY_OWNERS O, PMP_LICN_REQ R
    WHERE O.LICN_REQ_RECID = R.LICN_REQ_RECID
    AND O.MANAGER = 1
    AND NVL(O.EXP_MGR_ACT,0) <> 1 
    AND NVL (O.IS_ACTIVE, 0) = 1
    AND O.OWNER_CIVIL_ID = :PMP_MANAG.LICN_CIVIL_NO
    )AND ACTIVITY_PUR_RECID IS NOT NULL;
    
	V_LICN_REQ LICN_REQ_CUR%ROWTYPE;	
	error EXCEPTION;
BEGIN

OPEN  LICN_REQ_CUR;
 FIRST_RECORD;
LOOP
		FETCH LICN_REQ_CUR INTO :PMP_MANAG.LICN_REQ_RECID,:PMP_MANAG.ACTIVITY_PUR_RECID;
		EXIT WHEN LICN_REQ_CUR%NOTFOUND;
		GO_BLOCK('PMP_EXTRA_PURPOSE');
		FIRST_RECORD;
LOOP
		HIDE_VIEW('EXTRA_PUS_CAN');
		hide_window('EXTRA_PURPOSE_WIN');
		GO_BLOCK('PMP_MANAG');
						
IF :PMP_MANAG.ACTIVITY_PUR_RECID=:PMP_EXTRA_PURPOSE.ACTV_PURPOSE_RECID THEN	

                 HIDE_VIEW('EXTRA_PUS_CAN');
		 hide_window('EXTRA_PURPOSE_WIN');
	         GO_BLOCK('PMP_MANAG');
						
	:PMP_MANAG.COMPANY_NAME:=EST_GET_DATA.GET_COMPANY_NAME_PARENT(:PMP_MANAG.LICN_REQ_RECID);
	:PMP_MANAG.LICN_CENTRAL_NO:=EST_GET_DATA.GET_LICN_CENTRAL_NO(:PMP_MANAG.LICN_REQ_RECID);
	:PMP_MANAG.DATE:=SYSDATE;
[b]ELSIF :PMP_MANAG.ACTIVITY_PUR_RECID <> :PMP_EXTRA_PURPOSE.ACTV_PURPOSE_RECID THEN	
	 :PMP_MANAG.USER:=USER;
END IF;
[/b]
	        HIDE_VIEW('EXTRA_PUS_CAN');
		hide_window('EXTRA_PURPOSE_WIN');
		GO_BLOCK('PMP_MANAG');
		EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
NEXT_RECORD;
END LOOP;	
		
	NEXT_RECORD;
  END LOOP;

	FIRST_RECORD;
CLOSE LICN_REQ_CUR;

END;


[b]
[b]begin
	GO_BLOCK('PMP_MANAG');
	FIRST_RECORD;
	LOOP
   If :system.last_record = 'TRUE' THEN
   IF 	:PMP_MANAG.USER IS NOT NULL Then
      delete_record;
    End If;
    Exit;
  ELSE
    If 	:PMP_MANAG.USER IS NOT NULL Then
      delete_record;
    ELSE
      next_record;
    End If;
  END IF;
  END LOOP;[/b]
[/b]
  
end;

[Updated on: Sun, 29 January 2017 04:55]

Report message to a moderator

Re: FRM-40102 record must be entered or deleted first [message #659748 is a reply to message #659747] Sun, 29 January 2017 05:44 Go to previous message
Littlefoot
Messages: 21561
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK then; I'm glad you did it.
Previous Topic: how to store image in sql plus??
Next Topic: formsweb.cfg configuration
Goto Forum:
  


Current Time: Fri May 29 06:31:35 CDT 2020