By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,656 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

SubForm not updating

P: 4
Hi All,

I have a main form and subform the subform needs to get a value from the main form it is similar to the Northwinds invoice database, It updates the first product in the subform but any additional products that is added will not update.I am using the below to update the subform

Me.[Shipping_Orders_Detail_subform]![txtContactIDSubform].Value = Me.cboShipperName.Column(10)

is there a way I could modify the code above to get the subform to update as new products are added to the shipping order. I have tried using relationships to get it to update but does not work, so came up with this idea to use OnChange to update the records. so that when you select a contact it would sync the subform products in the subform. Any help or suggestions would be most appreciated.


Expand|Select|Wrap|Line Numbers
  1. Me.txtShipperAddress.Value = Me.cboShipperName.Column(2)
  2. Me.txtShipperCity.Value = Me.cboShipperName.Column(3)
  3. Me.txtShipperState.Value = Me.cboShipperName.Column(4)
  4. Me.txtShipperPostalCode.Value = Me.cboShipperName.Column(5)
  5. Me.txtShipperWorkPhone.Value = Me.cboShipperName.Column(6)
  6. Me.txtShipperFirstName.Value = Me.cboShipperName.Column(7)
  7. Me.txtShipperLastName.Value = Me.cboShipperName.Column(8)
  8. Me.txtShipperPaymentTerms.Value = Me.cboShipperName.Column(9)
  9. Me.txtContactID.Value = Me.cboShipperName.Column(10)
  10. Me.[Shipping_Orders_Detail_subform]![txtContactIDSubform].Value = Me.cboShipperName.Column(10)
2 Weeks Ago #1
Share this Question
Share on Google+
3 Replies


twinnyfo
Expert Mod 2.5K+
P: 3,257
thearn634,

There should be no need to set up your forms this way. If you have your tables properly related and your forms properly designed, You shouldn't need to populate your subform in any way.

My initial guess is that your tables are not constructed properly, which is why youa re duplicating data by sending that data between forms.

We would need to know more about your table structure and design before we can give you better advice on this one.

Thanks!
2 Weeks Ago #2

P: 4
Thank you twinnyfo,

I am a novice with access I used a template database and made some changes to it to fit my needs due to a time crunch, one day I will redo it from scratch, but for now I would just like to have the one field update each record for the shipper in the subform, (the last line of the code), everything else seems to work Ok or at least it will suffice for now, until I can get it rebuilt. What information would you need, I have attached the database for your review.

<attachment removed>
2 Weeks Ago #3

twinnyfo
Expert Mod 2.5K+
P: 3,257
Please know that we typically do not download users' DB's. Some of this is because many of our users access Bytes from work and they can't access them in the first place. The second is there is typicaly not a reason for us to download an entire database to troubleshoot one problem. Sometimes, there may be a need for us to do that, but we will explicitly request that database at that time. Third, many times databases have proprietary or personal information (I haven't checked yours), and so it would be inappropriate to post those files on line. Finally, (and this applies mostly to novices, but even to experts) many times, us opening a strange database will not help us at all--not until we know what's going on and why you have created what you have created. We can spend hours tracing through your DB trying to figure out where to start--that is not a wise use of our time. I've removed your DB for now. If we really need it, we will ask for it.

Back to the issue at hand, it would be helpful for us to know more about what you are trying to do.

Much about your posted code seems very strange. Why do you have a combo box with 11 columns? Why are you setting the values of all your controls from a combo box, rather than filtering the form on a certain record? If you have a subform that is in any way related to this record, why are you manually adding data to that form, rather than proerly structuring and relating those two tables/forms to each other?

I know you say you are a novice, and that's OK. But we are trying to help you design a DB properly, rather than just get a broken application working (but just barely).

Knowing more about your tables and knowing more about what you are trying to do will help us help you.

Thanks.
2 Weeks Ago #4

Post your reply

Sign in to post your reply or Sign up for a free account.