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

Subforms and Recordsets

Status
Not open for further replies.

lesp1

Technical User
Feb 18, 2002
15
0
0
GB
I have a Datasheet subform to a main form. The subform picks up data from one table, user adds values where necessary, then I need to add records to another table based on the values entered on the subform. I have no problems updating a recordset from the main form but not sure how to go about adding details from the subform.

Thanks

Les P
 
Hi

Not sure which bit you do not understand, but if you need to reference items on the sub form you need to use (from the main form) the syntax

Me.MySubFormControl.FORM.MyControlName

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Many thanks Ken. I was missing the "FORM" bit.

This does part of what I want, it picks up the currently selected row from the subform (Datasheet). Is there a way to pick up all records in the subform?

Thanks

Les P
 
Hi

Yes, (although I have not done it, so you are the guinea pig), you should be able to assign a recordset varibale to the recordsetclone of the sub form, and thus iterate through all of the records in the recordset

something like:

Set Rs = Me.MySubFormControl.FORM.RecordsetClone

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Many thanks Ken, I just put a Do Until rs.EOF loop in and scrolled through and got exactly what I needed.

Thanks for your help.

Les P
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top