That is the answer I was looking for :)
Thank you
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to assign and change the subdatasheet for a specific table via VBA code. The tips a found are all for setting the subdatasheet to "NONE" for all tables.
However, I am looking to do the opposite by programmatically (VBA code) setting a specific table as the subdatasheet to another table.
Any help is greatly appreciated
That is the answer I was looking for :)
Thank you
A subdatasheet represents the referencing table in a one-to-many relationship type in which the main datasheet represents the referenced table in the relationship. To create one in VBA, therefore, you need to create the relationship. This can be done with the DAO CreateRelation method. Take a look at the following topic on the method, which includes a detailed example:
I have already assigned these one-to-many relationships between the tables. However, depending on situation I would like to change which subdatasheet is shown for a given table (automating the command sequence Home - More - Subdatasheet - Subdatasheet....
Thank you
You are looking for the SubdatasheetName property to set:
CurrentDb.TableDefs("tblParent").Properties("SubdatasheetName").Value = "Table.tblChild"