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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating all records in a subform with value from Parent

Status
Not open for further replies.

klfduncan

Technical User
Jul 29, 2004
25
GB
Hi all,

I have a form, LsEdit, containing a WinLikely field (a number). LsEdit contains a datasheetview subform (continuous) containing 'x' number of fields, ConDet, each of which has a field percChance. These are linked by a one-to-many relationship on RefNum.

I want to update all 'x' number of fields in ConDet subform with the value of WinLikely in the LsEdit form.

In summary:

LsEdit (one); fields: RefNum, WinLikely
ConDet (many); fields: RefNum, percChance

When WinLikely is updated, I want percChance to take the new value of WinLikely for ALL records in that subform.

Currently I can only get it to update the first record.

Thank you for your time
 
Currently I can only get it to update the first record
How you do that ?
You may consider playing with the subform's Recordset (typed, untested):
With Me![ConDet control name].Form.Recordset
.FindFirst "RefNum=" & Me![RefNum control]
While Not .NoMatch
.Edit
!percChance = Me![WinLikely control]
.Update
.FindNext "RefNum=" & Me![RefNum control]
WEnd
.MoveFirst
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hey PHV,

thank you so much for this. I tried to give you a star, but my work browser said something about SpyWare.

Not only does this work great, but with this I finally have the syntax to manipulate the recordsets - you don't know how many wasted hours I've spent trying to sift through Access Help with examples which just plain don't work.

So thanks once more. My life is now significantly better!

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top