Expandable datasheet Subform?

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!
 
T

Tom Ellison

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
 
T

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top