Hi,
i have here trouble with Update a Form.
I Have a Form with a subform.
In Form Header i Have to important Fields:
Code and Subname.
The Data in Header cames from Table1, where i Have Primary Key on Field Code. The Subname Field has FieldClass FlowFilter in Table1. In Table2 exists Primary Key: "Code,Subname".
Then i Have a subform that looks me Entries in Table3 what have Key: "Code,Subname,LineNo".
In SubForm Propertys i have follow SubFormLink:
Subname=FIELD(FILTER(Code)),Subname=FIELD(FILTER(Subname))
(In Table Filter i have put ValueIsFilter)
When i get Next Record my subform updates correctly, it seems me all entries with the Selected Code in Form Header.
If i put data in Subname Field , it updates too correctly my subform, but only if Data in Table3 exists that have Key: "Code,Subname".
If They no exists records with "Code,Subname" then Navision it Brekas me out with an error that Record does not exists.
So i would Reset the Filter with the Subname, so that it not end with an error, but i don't know in what trigger or the location where i can put the code for does correctly this, i have tried with an Function that checks me with the actual Data (Code and Subname) if Record Exists in Table3, when NOT Find a Record, then must Reset Filter for Subname.
Then i have tried, without SubFormLink, and have tried with :
CURRFORM.SUBFORM.UPDATE(); But it says me that message like: SubForms are no permitted to update.
Very dificulty my english ... #-o
I Hope you can help me anyway.
Thanks
(Oo)=*=(oO)
0
Comments
You have 3 tables and 1 form (with a subform)
On table one the primary key is Code and you have a flowfield (lookup) based on Table 2,
On Table 3 you have entries linked to the header by Code field....
Two problems apprently :
1/ If your subname field on table 1 is a flowfield, you need to calculate it... and you shouldn't have a subformlink through that field...
2/ The usual subform link is not : but :
Now question is.... how can you have a flowfield for the Table 1 Subname field if the primary key on Table 2 is Code,Subname ?
Is it really a "Flowfield" or it is a Table relation ? In that case, you should'nt have any more problem....
But oh my foes and oh my friends, it gives a lovely light
("Table2".Subname WHERE (Code=FIELD(Code))
In Table1 ist Key: "Code"
In Table2 is Key for: "Code,Subname"
In Table3 is Key for "Code,Subname,LineNo"
Then i have One Form wich is based on Table1
In this Form i have the Field "Subname" such as Filter (when i pressed it, appears a Form wich List me the avaibles Subnames for each Code)
In this Form always i have a Subform wich is based on Table3.
And every time i change Subname or Code the Subform must show/update entries.
This works nice, if Records exists where the Filter is aplicable,
For example:
I Have 3 Records in Table1:
Code1
Code2
Code3
in Table2 I have:
Code1, Subname1
Code1, Subname2
Code1, Subname3
Code2, Subname1
in Table3 i have:
Code1,Subname1,10000
Code1,Subname1,20000
Code1,Subname1,30000
Code2,Subname1,10000
I RUn my form and it starts with first record (Code1) , the subform displays me nothing, because no entry exists with Code1 and Subname=''.
Well, i choose Subname='Subname1', then SubForm displays me follow records:
Code1,Subname1,10000
Code1,Subname1,20000
Code1,Subname1,30000
Now when i go to the next record from Table1, the Filter for Subname is placed, and subForm displays me imediately follow entries:
Code2,Subname1,10000
But now if i go to the Record (from table1) with Code='Code3'
Then Applications Breaks Out with an error and say me that no exists Record in Table 3 with Code='Code3', Subname='Subname1'
And this is what i would prevent, when this occurs i would reset filter or would give out an error that no recors exists, after this error navision close the form and exit to Menü, this is silly...
I Hope is better explained now
:oops:
:shock:
But oh my foes and oh my friends, it gives a lovely light
hmm.
In Table1 follow Fields:
"Code", "Subname"
Code has DatayType Code and is Primary Key.
Subname has Dataype Code and has FieldClass Filter.
"Code" Is Only primary Key.
In Table2 are Fields:
"Code" as DataType Code
and Subname as DataType Code.
Primary Key in Table2 is: "Code,Subname"
But oh my foes and oh my friends, it gives a lovely light
Yes i have tried yet this, but it doesn't work ...
...
Now i have init another way for solution my problem perhaps it is better , but i have too problems to realised it , and i have hedache now #-o
I have now One Form, i would make 2 fields with Lookups, in first field i want choose my Code from Table1, in second Lookup must be a filter so that i only can view subnames with the same Code selected , then when selected Subname it must Update TableBox....
I Have now my own 2 fields, and the first lists me my codes from table 1, but in second field i don't check how i must set the Filter, everytime it lists me all subnames for all codes...
So i go along intend to finish this (with machine gun?) :^o
Thanks ..
But oh my foes and oh my friends, it gives a lovely light
=D> =D>