Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-12-2010, 10:15 AM
SCFM SCFM is offline Windows XP Access 2010 (version 14.0)
Novice
 
Join Date: Feb 2010
Posts: 13
SCFM is on a distinguished road
Default Accessing a Tab with a HotKey

I have a Form with a 3 pages Tab Control. I'm trying to SetFocus in page x with a Hot Key using VB.

To do that I needed to:
1. Create an Event (I choose On Key Down):
2. Write the code

Both are not working. I mean I tried the following code for the event but It doesn't work:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
MsgBox "Key Down"
End Sub

I am thinking to use the following code for the page focusing.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF8 Then
Me!TabCtl1.Pages(3).SetFocus
End Sub

Thank you.
Reply With Quote
  #2  
Old 03-12-2010, 11:59 AM
ajetrumpet ajetrumpet is offline Windows Vista Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Mar 2010
Location: iowa city, ia
Posts: 83
ajetrumpet is on a distinguished road
Send a message via MSN to ajetrumpet Send a message via Yahoo to ajetrumpet
Default

i wonder if you could either use:

1) the hotkey code on a property sheet

2) focusing on the tabs you want based on the key you pressed.



1) to do this, I have put something like "&Hide" in the caption property of a cmd button. hence, the shortcut key for pushing the button is Ctrl+H. not sure if you can do that with tabs too, but you could try some focus code behind a button with a caption like "&1" or "&one"

2) i think key press events are only limited to special keys, like tab, enter, etc... I am not sure if you can apply tis event to actual character strokes. I have tested this and I cannot get anything to print when pressing letters. so I think you're stuck with those special keys. if you want to check on the KEYCODE though, I think you'll need an integer. such as:
Code:
if keycode 69 then
   
do something
end 
if 
check out these articles for the integers that are assigned:

http://support.microsoft.com/kb/113547

http://support.microsoft.com/kb/210401
Reply With Quote
  #3  
Old 03-13-2010, 04:28 AM
SCFM SCFM is offline Windows XP Access 2010 (version 14.0)
Novice
 
Join Date: Feb 2010
Posts: 13
SCFM is on a distinguished road
Thumbs up

Quote:
Originally Posted by ajetrumpet View Post
i wonder if you could either use:

1) the hotkey code on a property sheet

2) focusing on the tabs you want based on the key you pressed.



1) to do this, I have put something like "&Hide" in the caption property of a cmd button. hence, the shortcut key for pushing the button is Ctrl+H. not sure if you can do that with tabs too, but you could try some focus code behind a button with a caption like "&1" or "&one"

2) i think key press events are only limited to special keys, like tab, enter, etc... I am not sure if you can apply tis event to actual character strokes. I have tested this and I cannot get anything to print when pressing letters. so I think you're stuck with those special keys. if you want to check on the KEYCODE though, I think you'll need an integer. such as:
Code:
if keycode 69 then
   
do something
end 
if 
check out these articles for the integers that are assigned:

http://support.microsoft.com/kb/113547

http://support.microsoft.com/kb/210401
Thank you for your answer. For now I choose your first recommendation.
I used Page&1, Page&2,... and it's working with ALT+1, Alt+2,...without
any VB code. regards.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
adp accessing issue fillerup Security 3 03-10-2010 06:59 AM
Accessing Table via asp Errors KLynch0803 Programming 1 01-17-2010 06:59 AM
Accessing Code For a Query TexMax007 Programming 3 08-29-2009 06:08 AM
Accessing form controls dante Forms 15 07-28-2009 06:26 AM
Accessing subform fields nkenney Forms 1 04-21-2009 08:10 PM


All times are GMT -8. The time now is 08:27 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.