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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

button to simulate a "On Dbl Click" event for a field/control

Status
Not open for further replies.

SallyG

Technical User
Sep 20, 2000
8
0
0
GB
Hi,

I need to have a button simulate a "On Dbl Click" event for a field/control in a subform when the button is clicked.

I know there is probibly a better way of doing this but i do have a good reason for wanting to use this method.

I have tried various ways of simulating the Dbl Click but with no luck so can anyone help ???

Just for information reasons, here's what Im using:

Mainform = FrmData
Subform = SumFrmData1
field/control = CtlDataID

Button = ButRun

Thank you in advance

Sally
[sig][/sig]
 
Sally,

Do you want to simulate the event or "STIMULATE" it?

To "STIMULATE" it:

[tab]Call CtlDataID_DblClick

If this is not what you mean, please post more info. [sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
Michael,

Thank you for your reply. YES i did mean simulate a on double click event.

I tried putting your code on the &quot;On Click&quot; event of the button but it did not work and I got the error message &quot;Compile error - Can't find Project or library&quot;

any more ideas, what I am trying to do is this.

I have a button on my main form which when clicked, triggers (or simulates) a &quot;On Dbl Click&quot; for a field/control called DataID. This control is part of a subform (also held on the main form) which is displayed as a datasheet. [sig][/sig]
 
When the code you are trying to access is on a subform you need to create a public sub in the code for the subform like this. (Make sure this code is in the subform!)

Public Sub RunTheDoubleClick()
CtlDataID_DblClick
End Sub

Then you can call the public sub from your main form like this from your click event.

Forms(&quot;MainFormName&quot;)(&quot;SubFormName&quot;).RunTheDoubleClick

Change the MainFormName to your main form name and the same with the SubFormName

Only Public sub or functions can be called from outside the form they reside in.
[sig]<p>John A. Gilman<br><a href=mailto:gms@uslink.net>gms@uslink.net</a><br>[/sig]
 
THANK YOU ALL

Thanks Guys, My problem is now solved and all is working OK.

I am very grateful to you all

Regards

Sally [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top