"jeg ikke ønsker at oprette et overflødigt Feld hvis det kan undgås "
If your database is designed correctly then your tables will have relationships primary keys/foreign keys. You will normally need them when making queries. These relationships are also (normally) used in the forms/sub forms LinkFields, and works very similar to querying data on related tables. So I wouldn't say that these fields are "overflødigt"!
If I understand your question correctly, you have a field in the sub form and you use this as the .LinkChildFileds, and now, instead of using a field on the main form (normally this would be the primary key) you want to use a variable.
Try this. Make a form/sub form using the two tables and in the LinkChildField select the field you want to use. In the LinkMasetrField enter a values for example APPLE
Now open the form in form view. You will be prompted for a parameter value. If you now enter a value which you know exists in the sub form you will now see data on the sub form filtered on the value you just entered. Th ereason why your prompted is that in the background Access is building a query to filter the data on a field from the main form, but because APPLE isn't a field on the main form it asks you for the value to use to filter.
Anyway, another solution is, don't use linkmaster/linkchild fileds. And use either the filter property on the sub form or change the sub forms record source to an sql statement using WHERE SubFormID = valu eof variable
LinkMasterField peger jo - som navnet angiver - på et felt på din hovedform. Hvad vil du opnå ved at sætte linket til et tal !?! Det skal pege på et felt.
Jeg har linket ca 100 steder i forskellige varianter. Jeg sparer altså ca 100 overflødige felder da jeg står med variablen i forvejen som en del af VBA koderne
Hvis .LinkMasetrField= Funktion?(Id) ikke kan laves må jeg desværre oprette alle de overflødige felder der først vi variablen tildeles værdien for senere at blive tilsluttet .LinkMasetrField
Komplet molbo programering men sådan har man øjensynlig lavet det og det må man bøje sig for
If you have already saved using 100 unnecessary fields then you must have written just as many unnecessary lines of VBA code to replace the unnecessary fields!
As I said, you can use the sub forms filter property and put the value of the variable there, it will achieve the same as what your trying to do.
I har bekræftet der ikke findes en mulighed for .LinkMasetrField= Funktion?(Id) så nu bruger jeg Filter som terry korrekt oplyser. Det er bedre end overflødige Felder
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.