Hello All,
I have My PO screen....
I need when I lookup to Receiving Location my ship to code fied work as Editable & Non Editable condition.
Scenario - I have 2 receiving Location 1) A - Default 2) B - Non-Default
When I choose 1) A - Default then I need Ship to code Editable & Lookup
When I choose 2) B - Non-Default then I need Ship to code field is Non-Editable & No Lookup
I wrote the code
where location is a variable of Location Table
location.SETRANGE(location.Distributor ,TRUE);
location.SETRANGE(location."Company Name" , COMPANYNAME);
IF FORM.RUNMODAL(0,location)= ACTION::LookupOK THEN BEGIN
IF location."Default Warehouse"=FALSE THEN
CurrForm."Shipment Method Code".EDITABLE(FALSE);
VALIDATE("Location Code" ,location.Code);
END;
But it gives the Non-Editable for every Location.....
Please give the suggestion Quickly
Thanks
0
Comments
Did you try this code after validate?
IF "Default Warehouse"=FALSE THEN
CurrForm."Shipment Method Code".EDITABLE(FALSE);
is it working if you close and open the form?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
I am writing this code in Location Code of PO form in Onlookup trigger.
loc.SETRANGE(loc.Distributor ,TRUE);
loc.SETRANGE(loc."Company Name" , COMPANYNAME);
IF FORM.RUNMODAL(0,loc)= ACTION::LookupOK THEN BEGIN
VALIDATE("Location Code" ,loc.Code);
IF loc."Default Warehouse"=FALSE THEN
CurrForm."Shipment Method Code".EDITABLE(FALSE);
END;
Its working
But when I again select Default its still Non-Editable & lookup in also working in Ship to Code filed. I don't need lookup when i choose B Location.
CurrForm."Shipment Method Code" := NOT loc."Default Warehouse";
inplace of
IF loc."Default Warehouse"=FALSE THEN
CurrForm."Shipment Method Code".EDITABLE(FALSE);
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
IF loc."Default Warehouse"=FALSE THEN
CurrForm."Shipment Method Code".EDITABLE(FALSE)
else
CurrForm."Shipment Method Code".EDITABLE(TRUE);
it will do the same.
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
CurrForm."Shipment Method Code".EDITABLE := NOT loc."Default Warehouse";
Its Working Good....
Now What I'll do for Lookup...??
Becoz if its Non-Editable I also Need No LookUp.
Offcource..good Catch :thumbsup:
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
loc.get("Location Code");
IF NOT loc."Default Warehouse" THEN
EXIT;
IF FORM.RUNMODAL(0,ShpMetCode)= ACTION::LookupOK THEN
VALIDATE("Shipment Method Code" ,ShpMetCode.Code);
try something like this
loc is Location table
shpmetcode is Shipment Method table
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Putting all of this logic on the form is the WRONG thing to do.
RIS Plus, LLC