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

Get Field Data from Sub-Form in Continuous Form View

Status
Not open for further replies.

FabHead

Technical User
Joined
May 26, 2002
Messages
18
Location
US
I have a sub-form called MaintPartsUsed that is displayed in continuous form format. The sub-form may have from 1 to many records associated to the record in the main (parent) form.
I would like to be able to access each record in the sub-form. Then copy certain fields to an excel template (This I have the code for and can do). Then access the next record in the sub-form, copy to excel. continue this loop until I have copied the last record in the sub-form to excel.

So, The help I need is just to access the first record in the sub-form, I'll then insert my code to copy fields to excel, then loop to the next record until all records are copied.

Thanks in advance.
Rick

 
I have played around with similar ideas, sending mail messages to Outlook. The method I finally used that worked was to raise a recordset object, query a SQL string that used the link field as criteria and then looop through the recordset grabbing the information I needed.
 
Thanks, for the help. I've been working on it off and on with no luck. I did create and SQL string that uses the link field (MaintID) but I am unable to access the subform. I'm a bit weak in the use of recordset.

MaintPartsUsed_Query is the Record Source of the Subform I want to get the linked records from. MaintAction is the current form. MaintID is the linked field.

strSQL = "SELECT * FROM MaintPartsUsed_Query WHERE MaintID = '" & Forms!MaintAction!MaintID & "'; "

Any help in the code for the recordset for the subform would be appreciated.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top