Solved

Simulate double click event in access vba

Posted on 2013-01-17
30
2,101 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
 
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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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 119

Accepted Solution

by:
Rey Obrero 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

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…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now