Solved

Hotkey - SPACE BAR

Posted on 2002-04-25
4
761 Views
Last Modified: 2012-06-27
I use KeyPreview = True for form

Then have:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeySpace Then
 etc etc

Problem - if i run the program it performs the keydown event ok but also any command button that has the focus at the time - no good

How to simply get the SPACE BAR to perform something on its own ?
0
Comment
Question by:clapper100497
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
DrDelphi earned 100 total points
Comment Utility
Try this:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 32 Then
   MsgBox "Space key pressed"
   KeyCode = 0
End If



Good luck!!
0
 

Author Comment

by:clapper100497
Comment Utility
KeyCode = 0 did the trick !
Well done and thanks !!!!
0
 

Author Comment

by:clapper100497
Comment Utility
Thanks for such a simple solution
Appreciated !!!
0
 
LVL 6

Expert Comment

by:DrDelphi
Comment Utility
Cheers.

0

Featured Post

Free Trending Threat Insights Every Day

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.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 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

18 Experts available now in Live!

Get 1:1 Help Now