Hi all
I think this is a scope issue or a where the focus is issue but I cant see it.
This is my code attached to events on a browse.
it does a simple check on the existence of a data Pair in a table and then what gets done with that data.
I have got the detection going and there are some choices that get made.
when i say No to adding the record I want the focus to return to the first column of the browse using
Parentform:CONTROL_BROWSE1.home()
it doesn't work straight after the no selection
but does at the end of the function which of course is the wrong place.
please tell me the obvious.
regards
I think this is a scope issue or a where the focus is issue but I cant see it.
This is my code attached to events on a browse.
it does a simple check on the existence of a data Pair in a table and then what gets done with that data.
I have got the detection going and there are some choices that get made.
when i say No to adding the record I want the focus to return to the first column of the browse using
Parentform:CONTROL_BROWSE1.home()
it doesn't work straight after the no selection
but does at the end of the function which of course is the wrong place.
please tell me the obvious.
Code:
FUNCTION Product_ID_onchange as v () DIM GLOBAL VProd_ID AS n dim tbl as P dim qry as P dim nrecs as N VProd_ID = CONTROL_BROWSE1.Product_id.value 'ui_msg_box("On Change Event for Browse. Browse name is: ",this.name() + crlf()+ "Product ID " + VProd_ID + crlf() + "Customer ID" + VCust_ID) tbl = table.open("cust_prod_join") query.description = "Data_Pair_exist" query_order = "" query_filter = "Product_ID = VAR->VProd_ID .and. Customer_ID = VAR-> VCust_ID" query_flags = "" qry = tbl.query_create(query_flags, query_filter, query_order) nrecs = qry.records_get() IF (nrecs = 0) then qry.drop() responce = ui_msg_box("No Data Pair","This is a new product for this Customer. Do you want to add it?",UI_YES_NO) if responce = UI_YES_SELECTED then ui_msg_box("YES","YES") elseif responce = UI_NO_SELECTED then 'ui_msg_box("NO","NO") Parentform:CONTROL_BROWSE1.home() 'This doesnt work end if query.order = "" query.filter = "" tbl.close() END end if 'ui_msg_box("Data Pair Exists","This product already is made for this customer. No further action required",UI_INFORMATION_SYMBOL) tbl.close() Parentform:CONTROL_BROWSE1.home() 'this does work END FUNCTION
regards
Comment