Browser doesn't operate properly

vealj

New Member
I have a browser where I have three columns. You enter a company code and year and when you move off the year column the event validates the year and supplies the company name.

It works fine the first time you add a record to the browse. The second time you add a row, the leave-year event fires and produces an error because the the company code and the year are still blank.

What could I doing wrong?

The code for the two events is below.


On Button Add event to the browser:


DO:
br_company:insert-row.
create tt_glrpmrs no-error.
{&OPEN-QUERY-br_company}
apply "entry" to tt_glrpmrs.tt_company_code in browse br_company.

END.


Event: On Leave of the year column:
DO:

find first tt_glyears where
tt_glyears.gly_company_code = tt_glrpmrs.tt_company_code:screen-value in browse br_company
and tt_glyears.gly_year = int(tt_glrpmrs.tt_year:screen-value) no-lock no-error.
if not avail(tt_glyears) then do:
run getmsg (input "gldetbyacct":U, input 30, input true, input-output c_msgtext).
{&OPEN-QUERY-br_company}
end.
else do:
find first tt_arbranch_codes where
tt_arbranch_codes.ab_company_code = tt_company_code:screen-value
and tt_arbranch_codes.ab_branch_code = "GL" no-lock no-error.
if avail(tt_arbranch_codes) then tt_company_name = tt_arbranch_codes.ab_branch_name.
else tt_company_name = "Missing branch name".
end.

display tt_company_name with browse br_company.

END.
 
Top