Expandable datasheet Subform?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I hope this is an easy one. I'm building a form with various nested
subforms based on one to many table relationships. My last subform is a
rather large table with many possible records (depending on the record
selected in the master form). I want to be able to view this subform in its
own window as a datasheet. I've tried linking the forms, but the problem is
that when you link it doesn't automatically fill in the primary key value in
the subform, which is critical.

Please help!
 
Dear Phil:

If I undestand you, the thing you need to do is open the datasheet on a
query the filters to the desired PK value.

Tom Ellison
 
Dear Phil:

This code creates the query, assigning a name you assign for it, and opens
the datasheet:

Public Function OpenSQL(strName As String, strSQL As String) As Integer
On Error GoTo NoQuery
CurrentDb.QueryDefs(strName).SQL = strSQL
DoCmd.OpenQuery strName, acViewNormal, acReadOnly
Exit Function
NoQuery:
CurrentDb.CreateQueryDef strName, strSQL
Resume Next
End Function

Tom Ellison
 
Back
Top