Return Focus to Main form field

Datapac
Member Posts: 97
Hi,
I've designed a new version of the Sales Order form and subform where the control should work as follows:
MainForm.SellToCust - TAB
SubForm.No - TAB
SubForm.Qty - TAB
SubForm.No - TAB
SubForm.Qty - F6 -> Create new Order returning focus to SellToCust
The problem I have is with the returning focus to SellToCust after creating the new order. Here's the code I'm using behind the F6 menu-button:
If I put in the code commented out above (i.e. CurrForm."Sell-to Customer No.".ACTIVATE;), I get an message asking do I want to Rename the Record.
If I say Yes to this message I get a message saying I'm not allowed rename a Sales Header. If I say No, the new order is created but the Form stays on the previous order.
Leaving out this line of code results in the Form displaying the new Sales Header record but focus remains on Subform.Qty field.
Any ideas?
Thanks in advance,
Richie
I've designed a new version of the Sales Order form and subform where the control should work as follows:
MainForm.SellToCust - TAB
SubForm.No - TAB
SubForm.Qty - TAB
SubForm.No - TAB
SubForm.Qty - F6 -> Create new Order returning focus to SellToCust
The problem I have is with the returning focus to SellToCust after creating the new order. Here's the code I'm using behind the F6 menu-button:
// Save Current Record CurrForm.SAVERECORD; COMMIT; // Initialise New record INIT; "Document Type" := "Document Type"::Order; "No." := ''; INSERT(TRUE); COMMIT; SETRANGE("No."); IF xRec."Journey Code" <> '' THEN BEGIN "Journey Code" := xRec."Journey Code"; MODIFY; COMMIT; END; // CurrForm."Sell-to Customer No.".ACTIVATE;
If I put in the code commented out above (i.e. CurrForm."Sell-to Customer No.".ACTIVATE;), I get an message asking do I want to Rename the Record.
If I say Yes to this message I get a message saying I'm not allowed rename a Sales Header. If I say No, the new order is created but the Form stays on the previous order.
Leaving out this line of code results in the Form displaying the new Sales Header record but focus remains on Subform.Qty field.
Any ideas?
Thanks in advance,
Richie
0
Answers
-
Try to put a Currform.UPDATE(FALSE); just before the CurrForm."Sell-to Customer No.".ACTIVATE;Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks Alain, that's sorted it!0
-
I'm trying to do the exact same thing in 4.00 SP3 and i can't get the focus to switch to the "Sell-to Customer" control on the main form. It remains in the subform.
Any idea's?
Regards,Now, let's see what we can see.
...
Everybody on-line.
...
Looking good!0 -
Try to put property DelayedInsert=Yes in the subform.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
It's on the Sales Invoice form, so the DelayedInsert property is already set to true.Now, let's see what we can see.
...
Everybody on-line.
...
Looking good!0 -
Maybe some ActiveControlOnOpen-property? Or some hidden code that activates the subform?Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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