Lookup dates problem

Nav_Nav
Member Posts: 7
Hi,
I have 2 fields: "Month No." and "Month Name". I try to make a dynamic lookup for "Month No.", so that I can use the date table to fill both fields.
This code is written in the OnLookup trigger of "Month No."
Everything works perfect and the message shows exactly the record I want, except: I can't get to actually fill the record fields! No matter what I try, the record stays empty in the table. Even using a global variable doesn't seem to work; nav seems to forget the value after the onlookup has ended.
What could be the problem here? And: should my fields have a table relation?
I have 2 fields: "Month No." and "Month Name". I try to make a dynamic lookup for "Month No.", so that I can use the date table to fill both fields.
This code is written in the OnLookup trigger of "Month No."
Dates.RESET; Dates.SETRANGE("Period Start",DMY2DATE(1,1,0001),DMY2DATE(1,12,0001)); Dates.SETRANGE("Period Type",Dates."Period Type"::Month); IF FORM.RUNMODAL(123456703,Dates) = ACTION::LookupOK THEN BEGIN "Month No." := Dates."Period No."; "Month Name" := Dates."Period Name"; MESSAGE(FORMAT(rec)); END;
Everything works perfect and the message shows exactly the record I want, except: I can't get to actually fill the record fields! No matter what I try, the record stays empty in the table. Even using a global variable doesn't seem to work; nav seems to forget the value after the onlookup has ended.
What could be the problem here? And: should my fields have a table relation?
0
Comments
-
Do you modify your record by Calling rec.MODIFY or CurrForm.SAVERECORD after your code fills the fields?0
-
Since I run the table (not a form), and my code is in that table, I assume you suggest adding 'rec.MODIFY' at the end of my OnLookup trigger?
Doing this doesn't solve the problem.0 -
Try to open the table and do the lookup on some form. Do not test it when running the table directly from Object designer. Have you same problem?0
-
No, making a form based on the table solves the problem. Thanks!0
-
It is common that lookup code called from table started from Object designer is not commiting the changes. It is like when you start dataport directly from designer...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