OpenForm in a subform

samiuweb

Registered User.
Local time
Today, 14:22
Joined
Jun 18, 2003
Messages
18
Hello,
I searched up and down these forums for about 1 hour or so to find a topic related to my problem, but couldn't find anything... I hope this post is not redudant

Anyway, the problem is this one:

I have two tables: tblProjects and tblOrgs which are in a many-to-many relationship with each other through a third table that links them. In a form, frm_projects , i have added a subform where i can create the many to many linkages through combo boxes.

in the subform i have only 1 field from tblOrgs, namely OrgName. What I wanna do, is ondblClick on this name in the subform, I want to open the frm_orgs which would have all the fields in tblOrgs related to the specific record that is clicked.

I managed to use a macro with an openform and a where condition which works if the subform is opened on its own, but does not work when its within the frm_projects. In the latter case, it brings up a window asking for input regarding "Forms!frm_sub_orgs!OrgName" (frm_sub_orgs is the subform)

this is the WHERE condition in the macro:

[OrgID]=[Forms]![frm_sub_orgs]![OrgName]

I hope I have been specific enough...
Thanks anyone
Penar
 
As I recall you need to reference the Form object of the subform control as in:

[OrgID]=[Forms]![frm_sub_orgs]!Form![OrgName]
 
Use vba code instead of a macro
"[OrgID]=" & Me![OrgName]
 
thanks for the really quick reply,

but how would i go about doing that (sorryy....im part of that growing group of idiots !!)

pm
 
In the On Click event for the text box add the following code
DoCmd.OpenForm "YourFormName", , , "[OrgID]=" & Me![OrgName]
 

Users who are viewing this thread

Back
Top Bottom