Solved

Simulate double click event in access vba

Posted on 2013-01-17
30
2,184 Views
Last Modified: 2013-01-17
Is it possible to simulate a double click event in access vba?
0
Comment
Question by:SweetingA
  • 17
  • 7
  • 3
  • +2
30 Comments
 
LVL 2

Expert Comment

by:MMTadmin
ID: 38789714
cmdButton_DblClick

Private Sub cmdButton_DblClik

'Do something

End Sub
0
 

Author Comment

by:SweetingA
ID: 38789736
Sorry probably not well explained

I want to switch the focus on a form to a graph and double click the graph, not use a double click event


Thanks
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 38789739
Me.SomeOtherControl.SetFocus

... then as MMTadmin stated ...

Call SomeOtherControl_DoubleClick
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 26

Expert Comment

by:jerryb30
ID: 38789740
With what other event?
0
 

Author Comment

by:SweetingA
ID: 38789746
You'll have to excuse my lack of knowledge but if i try something like this i get a error, object does not support this property or method

Me.Graph1.SetFocus
Call Graph1.DoubleClick

Thanks
0
 

Author Comment

by:SweetingA
ID: 38789747
sorry i used _Doubleclick its just a typo
0
 

Author Comment

by:SweetingA
ID: 38789752
now i get sub for function not defined
0
 

Author Comment

by:SweetingA
ID: 38789763
Am i missing a module to use the call DoubleClick?
0
 

Author Comment

by:SweetingA
ID: 38789824
Anyone know?

What is the code that actually makes the doubleclick event work?
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 38789834
What are you trying to do? Enlarge the graph?
0
 

Author Comment

by:SweetingA
ID: 38789844
The graph displays on an after update event of a text box but only with a blank which box.

The graph detail never shows until i double click it.

So i want to double click it in vba and then move the focus back onto somthing else in the form so that i do not see the graph input table which also is displayed when i double click it.

Thanks
0
 

Author Comment

by:SweetingA
ID: 38789857
attached is a screen shot
screenshot.ppt
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38789869
in the design view of the form, select the graph and look at the Event properties tab the
On Dbl Click event

do you see it?
0
 
LVL 2

Expert Comment

by:MMTadmin
ID: 38789888
look in the help for the graph and see what a dblClick actually does and then just code it
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38789901
if there is a On Dbl Click event, you simulate it in vba with

public sub graph.dblclick(cancel as integer)

end sub
0
 

Author Comment

by:SweetingA
ID: 38789904
Hello Capricorn 1,

Yes i see it and i can understand that i can do things after double clicking it by using this but how do i double click it in the first place in vba?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38789941
make the event public, so you can call it from other place

see my post at http:#a38789901
0
 

Author Comment

by:SweetingA
ID: 38789968
Sorry i clearly too thick to follow the excellent advice, can you be more explicit for an idiot like me.

Public Sub Graph1_DblClick(Cancel As Integer)
End Sub

Private Sub Measure_AfterUpdate()
   Me.Graph1.Visible = True
   Me.Graph1.SetFocus
   Me.Graph1_DblClick
End Sub


Just results in "object not optional"

Thanks for your patience
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38789971
can you upload a copy of the db
0
 

Author Comment

by:SweetingA
ID: 38789983
yes of course, give me a minute or two
0
 

Author Comment

by:SweetingA
ID: 38789995
Its in frm_PDM_Results

Runs in the after update event of Measure

You might have to populate all 4 combo boxes to get it to trigger, please select...

2012, 01, WorkingCapital, NetBindingDays then i can be sure we are looking at the same thing.

By the way if you fix it you can help me solve why i cant move the focus back off it straight after (see code commented out)

Thanks for the help
TargetTracking.mdb
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38790014
use this


Me.Graph1_DblClick (0)
0
 

Author Comment

by:SweetingA
ID: 38790029
got rid of the error but never displayed the graph until i double clicked it manually
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38790032
it is working here..
TargetTrackingREV.mdb
0
 

Author Comment

by:SweetingA
ID: 38790036
not on my pc its not, still shows a white square until i double click it manually
0
 
LVL 2

Expert Comment

by:MMTadmin
ID: 38790040
You are just entering the Graph1_DblClick event

What the control actually does when you double click is still a mystery

If there is nothing already coded in the event then you need to look at the control and see what is actually happening when you dblClick it
0
 

Author Comment

by:SweetingA
ID: 38790050
how do i do that?
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 38790072
the graph that you have, have a value of double click in the Auto Activate property

it is on the Other Tab

set the Property to  GetFocus

you can then delete the Me.Graph1_DblClick (0)
0
 

Author Comment

by:SweetingA
ID: 38790096
that did it, thanks a lot
0
 

Author Closing Comment

by:SweetingA
ID: 38790102
perfect and simple in the end
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question