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!

Help with printing records on a subform

Status
Not open for further replies.

MrM121

Programmer
Aug 21, 2003
83
GB
Hi,

I have a main form with a contact log subform in datasheet view (the subform is in datasheet view!). I have set the mechanism up correctly so that new logs can be added, and then displaying the last record, but that isn't my problem.

My problem is that I want to be able to output the details of the currently selected SUBFORM record to a report, but I am unsure how to do it.

In the table that contains the subform data, there are 4 fields, a date field for the date of the record, a message field, an ID number for the record (autonumber), and a reference code, which is linked with the main form. So obviously I want to be able to take the ID field data and stick it in a query. However, on the subform I have only put the date and message fields (as the ID and Reference fields aren't needed).

Does anyone know how to identify the content of the ID field in the table, even though it is not on the form?

Thank you,

Nick
 
And 1 more thing, I forgot to mention that I want to be able to print the subform record from a button on the MAIN form.

Thanks
 
Ok, I figured it out - here is the code in case anyone else has a similar problem:

Dim rs as DAO.Recordset

set rs = me.SUBFORMCONTROL.form.recordsetclone

If Not rs.RecordCount = 0 Then
rs.Bookmark = SUBFORMCONTROL.Form.Bookmark
MsgBox rs!UNIQUEID
End If
rs.close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top