Code to pass value from subform to control on parent?

J

John Garvey

Could anyone tell me the proper syntax for passing a value from a control in
a (datasheet) subform to a control on the parent form? Just to make sure I'm
using the right terminology here, parent form is based on tbl_Items, and
subform is based on tbl_RelDates (linked by ItemID). After updating the
RelDate control on the subform, I'd like to update the value in the Release
control on the parent form. (I want to actually update the Release field in
the record for that ItemID in tbl_Items.)
 
A

Allen Browne

It would be something like this:
Me.Parent!Release = Me.RelDate

In most cases, this would not be a good idea, John. Unless there is some
reason why tbl_Items could have a Release date that does not match the
RelDate of any item in the subform, tbl_Itmems should not have this field.
It should be calculated as needed from the subform.
 
J

John Garvey

Thanks Bob and Allen,

I guess i'm the classic case of someone who knows just enough to be
dangerous. I know that i should not be duplicating data in 2 different
tables, but I have found it very difficult (at my skill level) to manage
common tasks like forecasting, etc., when the release date information is
stored only on tblRelDates., not on tblItems.

I have a query qryLatestRelDates that calculates the Max of the "as of" date
to determine the most recent (currently valid) release date for each item ID,
and using that I have easily created good reports, but I haven't been able to
figure out how to set up workable forms. We require a datasheet-style
forecast form that sorts the items by release date, and allows us to enter
the forecast value for that Item. When I've tried creating such a form based
on a query of tblItems and qryLatestRelDates, the form has not been editable
due to the underlying relationships. I don't know how to get around that.
I'd be eager to learn that, if it's the better way to go.
 
J

John Garvey

OK, I think I get how this should work. I've created a form showing the
products as I need to view, them, by customer, and I'll creat a pop-up form
that will allow me to enter the forecast. Thanks again for the advice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top