subforms with DoCmd?

J. Davis

Registered User.
Local time
Today, 12:15
Joined
Jan 24, 2010
Messages
29
Hi,

I've been trying to tweak my form-embedded query such that double-clicking one of the rows (whose data is locked) will open a corresponding form where the data can be edited. The query is a join of several nested tables, and the form that opens contains several levels of subforms that roughly mirror the table structure.

Right now I've got a line of code opening the top-level form of the record identified in the query:

DoCmd.OpenForm "TOP_LEVEL", , , "top_level_id = [FORMS].[EMBEDDED_QUERY].[top_level_id]"

So far, so good. But now, I need to find a way to have the top level form display the sub form and the sub-sub form corresponding to the query's remaining entries.

With Access (and VBA in particular), I've learned that when I spend more than two hours searching the web without success, it means I'm considering the problem in the wrong way....Is DoCmd the right tool for this task?

Thanks in advance.
 
Hi,

I've been trying to tweak my form-embedded query such that double-clicking one of the rows (whose data is locked) will open a corresponding form where the data can be edited. The query is a join of several nested tables, and the form that opens contains several levels of subforms that roughly mirror the table structure.

Right now I've got a line of code opening the top-level form of the record identified in the query:

DoCmd.OpenForm "TOP_LEVEL", , , "top_level_id = [FORMS].[EMBEDDED_QUERY].[top_level_id]"

So far, so good. But now, I need to find a way to have the top level form display the sub form and the sub-sub form corresponding to the query's remaining entries.

With Access (and VBA in particular), I've learned that when I spend more than two hours searching the web without success, it means I'm considering the problem in the wrong way....Is DoCmd the right tool for this task?

Thanks in advance.

Is your subform and "sub -sub" form embedded within the form that is opened using Docmd?
 
Yes. .
 
You want to reference the subform approrpriately and access will do the filtering. Look at the following properties of your subform, Source Object, Link Master Fields, Link Child Fields on the Data tab.
 
You can do this using vba, if I read right then when your main form opens it opens a subform displaying data which you have filtered(?)

But now you need to open another form only when double clicked(?)
If you got your first form to open using a filter sounds like you just need to code similarly to the subform? Are you putting the code into the subform and not the main form? This is where it needs to be.
 

Users who are viewing this thread

Back
Top Bottom