The Problem
I have two continuous subforms A and B in a tabular layout on a main form C. The first has the names of some chemicals, the second has corresponding info on those chemicals. I have a field D on C that takes the value of the primary key [stoff_id] of A for the current record. B is linked to D, so it shows all corresponding records for the currently selected chemical. Here a quick overview of the database:
The query for A [stoffe_abfrage subform]:
SELECT chemikalien_tabelle.stoff_id, chemikalien_tabelle.bezeichnung,
chemikalien_tabelle.einsatzgebiet, kategorie_tabelle.kategorie
FROM kategorie_tabelle INNER JOIN chemikalien_tabelle ON
kategorie_tabelle.[kategorie_id] = chemikalien_tabelle.[kategorie_id];
The query for B [tmb_abfrage subform]:
SELECT tmb_tabelle.version, tmb_tabelle.datum_aktualisiert,
tmb_tabelle.datum_upload, sprachen_tabelle.bezeichnung,
tmb_link.stoff_id, tmb_link.tmb_id, tmb_tabelle.datei.FileType,
tmb_tabelle.datei
FROM (sprachen_tabelle INNER JOIN tmb_tabelle ON sprachen_tabelle.
[sprache_id] = tmb_tabelle.[sprache_id]) INNER JOIN tmb_link ON
tmb_tabelle.[tmb_id] = tmb_link.[tmb_id];
The value of the control D [MainLinkStoff] on C:
=[stoffe_abfrage subform].[Formular]![stoff_id]
(B is linked from [stoff_id] on B, to D)
I want to use the primary key value on A in a button event on B, so I need a way to reference it. Unfortunately, referencing the primary key (stoff_id) on A from B only works if B is not empty. If there are no records on B, then the reference of stoff_id on A from B turns empty, event though the value of the control on A itself is nonempty.
What I have tried:
for the second test I tried 2 different approaches:
Get D from C via parent
=[Me].[Parent].[MainLinkStoff]
Get the D value manually from forms
=Formulare![HUB]![NavigationSubform].Formular![MainLinkStoff]
In both approaches, if the chemical already has records in B, the dummy and D both display the value of the primary key correctly and are identical. If the chemical has no current records in B, D on the parent form displays correctly but the dummy is suddenly empty too. Why is this? Here some images of what I mean. D is in the top middle of the form C, the dummy adjacent to it on the right subform B. A is on the left, B on the right. (invisible borders)
So, I found the issue. I was working on the project from 2 different computers. One used the German language version of Access, the other the English language one. Object references created by wizards and internal tools in those versions use different formulations ([Forms]=[Formulare] etc.). What ended up happening was that some object references in SQL queries, criteria etc. were in German, the objects themselves had further references that were in English, which in turn referenced others that were in German again. This worked most of the time, but quite often, especially in fringe cases, it resulted in Access messing up the references completely. For example in cases where queries or field values were returned empty. I am not entirely sure how Access manages the conversion of references in different language versions, but there seem to be issues with it when mixing them. The solution was to choose one language version to use for references, and stick with that formulation for the entire project. I tested both, and either German or English work fine, on either version of accesss. Mixing them up within the same project however, creates problems.