Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to Open Multiple subforms byDblClick on Record 1

Status
Not open for further replies.

np3il

Programmer
Aug 15, 2002
63
US
Hello,

MS-Access (VBA) subform problem.

I have two subforms that I need to open by dbl-click an field on the record.

Is there a way to do this?

I tryied the On Double-click property but this only works for one subform in an old apps.

If I am looking at a Subform1/Subform2 and double-click on the record item it gives me an error "The expression On Dbl Click you entered as the event property setting produced the following error: The object referenced in the VB procedure as an OLE object isn't an OLE object."

What did I do wrong?:-(

help

Thanks
np3il
 
I don't think that I completely understand how you tried to solve the problem. Therefore I can't say for sure what you did wrong. You should've been able to use the dblclick event to open both subforms at the same time by saying:

docmd.openform("subform1")
docmd.openform("subform2")

Bobby Strickland
Solutions Engineer
Strictly Consulting, Inc
http:'Pleasure in the job puts perfection in the work' -- Aristotle
 
I concur - not enough information. Giving a line of code without the error message or an error message without the code is pretty hard to get help on.

Also, by using the word subform, you immediately set some of us thinking you have a subform in your form which I suspect you do not. I suspect you mean you have 3 forms. Two of these you want to open when you double click on a field in your main form.

To do this, make sure your event is linked to an Event Procedure and paste Bstrick75's code in there substituting the names of your forms for the names he has created.

 
Let me explain it better,

When I am working with Table1 I need to open subform1.
When I am working with Table2 I need to open subform2.

I am using a subform fsumParkSub to received and display the other subforms.

I select the Tables by using an OptionButton optTable1 & optTable2.

if optTable1.defaultValue = true then
Form!fsumParkSub.SourceObject = Table1
else
Form!fsumParkSub.SourceObject = Table2
endif

This works for displaying the subforms.

But when I double-click on the field that I need to open the edit subform for the selected Table1 or Table2.

It is this part (the double-click) that I am having touble with.

In the On Dbl-Click I have "=OpenAnyForm("f" & Mid([smastertable],2),"Licence_Plate =" & Forms!fsumParking!fsumParkSub.Form!txtLicence & "")".

I get the posted error: "The expression On Dbl Click you entered as the event property setting produced the following error: The object referenced in the VB procedure as an OLE object isn't an OLE object."

I hope I have explained the situation better.

Any suggestion would be appreciated.

Regards
Np3il
 
Thanks PCLewis

By Making the event [Event Procedure] the code I had work like a charm.

Best Regareds
Np3il
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top