J
jaworski_m
I use the following code in the OnClick event to open subform (variables
declared) with specific record(s).
---- CODE START ----
stDocName = "sub_Form_Name"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
---- CODE END -----
1) If records in the sub form exist - it opens OK, corresponding records are
shown.
2) If there are NO records, it opens BLANK and the ID field,i.e.Primary Key,
contains NULL value - adding new record has no sense, because there is no
link between the related tables.
QUESTION: What's the way to open the sub form with the above code so the
Primary Key value is populated to the "many table"?
Thank you for suggestions.
declared) with specific record(s).
---- CODE START ----
stDocName = "sub_Form_Name"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
---- CODE END -----
1) If records in the sub form exist - it opens OK, corresponding records are
shown.
2) If there are NO records, it opens BLANK and the ID field,i.e.Primary Key,
contains NULL value - adding new record has no sense, because there is no
link between the related tables.
QUESTION: What's the way to open the sub form with the above code so the
Primary Key value is populated to the "many table"?
Thank you for suggestions.