R
raylopez99
THis is a very basic question, since I'm learning Access without a
book, so don't read too much into it, and from my description I trust
you understand where I'm going. This post is a repost of another
thread that got rather long so I broke it into a new post.
As you can see below, the issue is how to bring into your child
subform a field that is not a migrated primary key (that is, is not a
foreign key) from the parent form, so that this field can be bound to
control (e.g. a text box) in the child subform, mainly so that the
user of the subform has a visual clue (ie the field will be read
only). There must be a way, as I'm sure this is a frequent problem.
My workaround below is not elegant and I trust there's a better way to
do this.
Thanks
RL
Hello Tina--Everything worked fine, exactly as you planned it, thanks
again, it's perfect with one small caveat (I will repost this question
in microsoft.public.access.formscoding in case you or anybody else
misses it here): this is an Access database programming question (I
think), and it's very basic and simple: in the final two tables,
"tblAccountStocks" and "tblTransactions", linked by AcctStockID, I
want to add a field (the stock symbol) from the parent table
tblAccountStocks form, so that it appears (i.e., is read only) in the
child subform (which has data control record source tblTransactions of
course). Mainly so the user of the form has a visual clue, not to
populate any table (i.e., the field is read only). But in the drop
down List box data source: Properties | Data | Control Source these
parent fields don't show up (they never do--that's the heart of the
problem, and I'm wondering if there's something I'm missing). Only
the migrated primary key (i.e. the foreign key) which in your example
was "AcctStockID (fk)" shows up, as well as the other fields of the
subform table of course. I want to add to these fields a "stock
symbol" (StockSymbol) field from the parent table, since it's less
confusing to the user using the subform. Here's what I did, and it
works, but I'm wondering if there's a more elegant solution: I simply
added another primary key, "StockSymbol (pk)" in the parent form
(tblAccountStocks), and so now there are two primary keys (a compound
key), then I migrated this newly added key (i.e. made it a foreign
key) for the child subform table "tblTransactions". Thus the form and
subform are now linked by two keys rather than one: AccountStockID;
and StockSymbol; as can be seen when you click on the subform
properties under the heading "Link Childfields", "Link Master
fields". This workaround worked fine, but it seems this workaround
violates database design a bit, and I'm wondering if I can somehow
directly show a field from the parent form in the child subform
without going through this tedious workaround (preferably without
touching any Visual Basic code or [procedures], but I can deal with VB
if I have to)
Thanks!
RL
book, so don't read too much into it, and from my description I trust
you understand where I'm going. This post is a repost of another
thread that got rather long so I broke it into a new post.
As you can see below, the issue is how to bring into your child
subform a field that is not a migrated primary key (that is, is not a
foreign key) from the parent form, so that this field can be bound to
control (e.g. a text box) in the child subform, mainly so that the
user of the subform has a visual clue (ie the field will be read
only). There must be a way, as I'm sure this is a frequent problem.
My workaround below is not elegant and I trust there's a better way to
do this.
Thanks
RL
Hello Tina--Everything worked fine, exactly as you planned it, thanks
again, it's perfect with one small caveat (I will repost this question
in microsoft.public.access.formscoding in case you or anybody else
misses it here): this is an Access database programming question (I
think), and it's very basic and simple: in the final two tables,
"tblAccountStocks" and "tblTransactions", linked by AcctStockID, I
want to add a field (the stock symbol) from the parent table
tblAccountStocks form, so that it appears (i.e., is read only) in the
child subform (which has data control record source tblTransactions of
course). Mainly so the user of the form has a visual clue, not to
populate any table (i.e., the field is read only). But in the drop
down List box data source: Properties | Data | Control Source these
parent fields don't show up (they never do--that's the heart of the
problem, and I'm wondering if there's something I'm missing). Only
the migrated primary key (i.e. the foreign key) which in your example
was "AcctStockID (fk)" shows up, as well as the other fields of the
subform table of course. I want to add to these fields a "stock
symbol" (StockSymbol) field from the parent table, since it's less
confusing to the user using the subform. Here's what I did, and it
works, but I'm wondering if there's a more elegant solution: I simply
added another primary key, "StockSymbol (pk)" in the parent form
(tblAccountStocks), and so now there are two primary keys (a compound
key), then I migrated this newly added key (i.e. made it a foreign
key) for the child subform table "tblTransactions". Thus the form and
subform are now linked by two keys rather than one: AccountStockID;
and StockSymbol; as can be seen when you click on the subform
properties under the heading "Link Childfields", "Link Master
fields". This workaround worked fine, but it seems this workaround
violates database design a bit, and I'm wondering if I can somehow
directly show a field from the parent form in the child subform
without going through this tedious workaround (preferably without
touching any Visual Basic code or [procedures], but I can deal with VB
if I have to)
Thanks!
RL