darkjh
darkjh

Reputation: 2861

How can I open a query in datasheet mode in a subform?

I have a subform on a mainform. I want to have it open a query in datasheet view. I tried:

Me.subform.Application.DoCmd.OpenQuery "xxx"

But it just opens the query in the background, not inside the subform.

I know that by creating a form bounded to this query, then I can change de subform's SourceObject to open it inside the subform. However I have here many different queries, I just want to find a simpler way.

EDIT: Maybe something like: Me.subform.OpenQuery "xxx", but I didn't find it.

Upvotes: 1

Views: 1992

Answers (1)

TheOtherTimDuncan
TheOtherTimDuncan

Reputation: 603

Set the sub form's Source Object to a query name instead of a form name. In the property sheet, it should look like Query.XXX.

Upvotes: 3

Related Questions