Home » Developer & Programmer » Forms » go to last record + 1
go to last record + 1 [message #179842] Thu, 29 June 2006 00:54 Go to next message
cong
Messages: 25
Registered: June 2006
Junior Member
when adding record, how can i make the current record = last record + 1. this means that after clicking the add button, a new record is inserted at the row after the last record and the cursor is there also. thanks!
Re: go to last record + 1 [message #179847 is a reply to message #179842] Thu, 29 June 2006 01:06 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Moved to Forms.

MHE

Re: go to last record + 1 [message #179849 is a reply to message #179847] Thu, 29 June 2006 01:12 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
"Add button" should have this code:

last_record;
create_record;
Re: go to last record + 1 [message #180066 is a reply to message #179849] Fri, 30 June 2006 01:44 Go to previous messageGo to next message
cong
Messages: 25
Registered: June 2006
Junior Member
what if no records are fetched, this will cause an error right? how do i make sure that there are records fetched? thanks again!
Re: go to last record + 1 [message #180084 is a reply to message #180066] Fri, 30 June 2006 02:20 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You could try something like this:
if :system.last_record = 'TRUE' then
   null;
else
   last_record;
   create_record;
end if;
Re: go to last record + 1 [message #180086 is a reply to message #180084] Fri, 30 June 2006 02:27 Go to previous messageGo to next message
cong
Messages: 25
Registered: June 2006
Junior Member
can i do this also?

no_of_rec := Get_Block_Property('ACCNT_FEES_MASTER',QUERY_HITS);
IF no_of_rec > 0 THEN
LAST_RECORD;
END IF;
CREATE_RECORD;
Re: go to last record + 1 [message #180090 is a reply to message #180086] Fri, 30 June 2006 02:34 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Why don't you try Wink

It is not LAST_RECORD that throws an error, but CREATE_RECORD. As it is outside of the IF-THEN block, it will always be executed (no matter what is the result of the GET_BLOCK_PROPERTY) and, eventually, raise an error.
Previous Topic: How to check old value and new value for text item attached to a LOV in library
Next Topic: Currency Group Separator
Goto Forum:
  


Current Time: Fri Sep 20 09:46:58 CDT 2024