Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subforms and data update management

Status
Not open for further replies.

IRedsell

Technical User
Jun 8, 2006
6
GB
Firstly I am a self taught AccessVB Programmer

This means that I have probably missed something, but I have been through all the FAQs and trawled the web and cannot find out if what I am trying to do is just stupid or possible.

What I am trying to do is populate a subform with a number of items from a couple of tables. So I created a pair of combi boxes and tried to use one to the other as described in the FAQs - works fine in form view - in datasheet view of course even though they are bound controls the whole column fills with the selected SQL query. To get around this I created a separate unbound field and cached my answer using an event and VB- so far so good but messy.

Then I have a number (5) fields in my table which need to be calculated based on the collated fields from the tables. I created them first with VBCode, but the trusty Me!control.column etc will work if I click on a row, but I I wanted to recalculate the whole table I need to find a way of marching through each record and then the Me!control will not work.

So then I tried creating a calculated control for each, the form works beautifully, trouble is I can't see a way of writing these controls back to the database because I don't know which row I am in. Again I am missing some key subform knowledge

It seems I have missed a fundamental piece of knowledge about datasheets as what I want to do would work in a form, but ideally I want the user to create a number of entries in a schedule.

Is someone willing to help me dig my way out of this, I am normally self motivated but I am starting to get buried here? Please turn the light on, I have spent a couple of days floundering.

Can someone help me to write calculated controls back to the row and field or?

Can I use VB to march through records and calculate each field as I need it?

Thanks for any and all advice
 
Normally you would't store calculated control, because most of the time there is no need for it.

Pampers [afro]
Just let it go...
 
Ok perhaps I should make myself more clear

supposing I had a table with income, sex,age and I wanted to combine it with a table showing region,job etc and I wanted to create a field for salary expectation by combinig the fields ie. x*y*z/k how would you do it?

Would you do it in VB or in a control?
 
I think a calculated control, otherwise you have to tell vba when to fire to make the calculation.
But you maybe also want to consider doing the calculation in a query (it is fast) and making the query the control source of your form/report

Pampers [afro]
Just let it go...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top