Open 2 forms, close 2 forms

jwilder
Member Posts: 263
I am programatically opening first the Sales Comment Line Form like this:
SalesCommentLine.SETRANGE("Document Type",SalesCommentLine."Document Type"::Order);
SalesCommentLine.SETRANGE("No.","Document No.");
FORM.RUN(67,SalesCommentLine);
Then I am opening the Sales Order Form like this:
SalesHeader.GET(SalesHeader."Document Type"::Order,"Document No.");
FORM.RUNMODAL(42,SalesHeader);
So 2 forms open and if the windows aren't maximized they can be displayed next to each other. If the user closes the sales comment line form first, it pops them over to the Sales Order form which they can then close as well.
The problem is if they close the Sales Order Form first it keeps the Sales Comment Line Form open.
How can I close this form automatically? I want it to work as if I had used the RunFormLink property to open the Sales Comment Line Form. If you use that property and you close the main form it automatically knows to close the form in the RunFormLink property.
My guess is that this can't be done through code but maybe someone has an idea?
SalesCommentLine.SETRANGE("Document Type",SalesCommentLine."Document Type"::Order);
SalesCommentLine.SETRANGE("No.","Document No.");
FORM.RUN(67,SalesCommentLine);
Then I am opening the Sales Order Form like this:
SalesHeader.GET(SalesHeader."Document Type"::Order,"Document No.");
FORM.RUNMODAL(42,SalesHeader);
So 2 forms open and if the windows aren't maximized they can be displayed next to each other. If the user closes the sales comment line form first, it pops them over to the Sales Order form which they can then close as well.
The problem is if they close the Sales Order Form first it keeps the Sales Comment Line Form open.
How can I close this form automatically? I want it to work as if I had used the RunFormLink property to open the Sales Comment Line Form. If you use that property and you close the main form it automatically knows to close the form in the RunFormLink property.
My guess is that this can't be done through code but maybe someone has an idea?
Jason Wilder
jwilder@stonewallkitchen.com
jwilder@stonewallkitchen.com
0
Comments
-
Is the SalesCommentLine local or global? If it is global, try to define it as local.0
-
It is local already but becasue of your thought it made me notice that when I close the form that calls the code above (custom form called Find Order) it does close the Comment Line Form at that time. It's too bad it doesn't close it when the variable form goes out of scope.
Any more thoughts?Jason Wilder
jwilder@stonewallkitchen.com0 -
Than try to call it from e.g. codeunit, which will go out of scope when the function ends (locally defined codeunit variable).0
-
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions