UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Command Button To Open The Records That Correspond With A Subform Record    
 
   
Olga W
post Jan 14 2011, 02:19 PM
Post #1

UtterAccess Enthusiast
Posts: 67
From: London



I'm not certain this is the correct forum - tell me if this is the case.

I've figured out that I can open forms to corresponding records using the command button wizard, but this wizard doesn't allow you to select fields within a subform for this purpose, unless you place the button in the subform itself. This is fine, unless you have the subform set to datasheet view, in which case the button is invisible. How do I get around this?

I imagine that if you create the button without the wizard, using the macro builder or VBA, the location of the button might be irrelevant --- if you manually select the domain from which the control whose records you open to is taken....

I've had a look at the macro behind a regular "open to specific records" command button - but it just refers to the form in shorthand because access knows it means itself. I don't know the syntax to select the subform as the place to look for the record that corresponds with the form I'm opening.

Thank you for any help you can give me.
Go to the top of the page
 
+
missinglinq
post Jan 14 2011, 02:41 PM
Post #2

UtterAccess Ruler
Posts: 2,658



I do the following for this sort of thing:

In Design View for the form the subform is based on
  1. Create a command button
  2. Follow the Wizard's instruction to set it up to open the secondary form
  3. Now go to the Property Pane for an appropriate control on your form
  4. Click on the ellipse to go to the control's Double Click event
  5. Copy the code from the OnClick event of the command button you just created
  6. Paste the code into the selected control's Double Click event
In a Datasheet View form the command button won't show, of course, but you can double-click the control you used and open the secondary form.

Linq ;0)>
Go to the top of the page
 
+
Olga W
post Jan 26 2011, 08:36 AM
Post #3

UtterAccess Enthusiast
Posts: 67
From: London



Oh my God that is WAY cool! ! ! ! ! ! ! ! ! ! !

Thankyou for that tip. I hadn't even considered the possibilities of the on double click event! And I hadn't thought of looking behind that button for its code. Joy of joys!
Go to the top of the page
 
+
missinglinq
post Jan 26 2011, 08:48 AM
Post #4

UtterAccess Ruler
Posts: 2,658



Glad to help! Generating code using the Wizards, then examining that code, is actually a very good way of learning code.

Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 21st May 2013 - 10:54 PM