dbTalk Databases Forums  

simulate keypress

comp.databases.ms-access comp.databases.ms-access


Discuss simulate keypress in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Daan
 
Posts: n/a

Default simulate keypress - 03-06-2008 , 08:35 AM






Hello,

I have to start a Command_Click event with the simulation of pressing the
PgDown-key. Is this possible?

Private Sub Command_Click()
'press the PgDown - key
End Sub

Thanks



Reply With Quote
  #2  
Old   
Rich P
 
Posts: n/a

Default Re: simulate keypress - 03-06-2008 , 11:52 AM






In order to take on the function of the keydown event in a click event
of a command button would require overloading the click event of the
command button. Overloading is an Object Oriented programming feature
(OOP). So yes, this would be doable in an OOP environment. But VBA is
not an OOP environment. So this would not be doable in VBA.

However, if the goal is to achieve a scrolling type of function with a
command button in VBA, this can be done but would require some coding
(what I call spaghetti coding).

So the question now would be if it is worth the effort to write a bunch
of code in VBA to achieve the same functionality you could achieve in
OOP with one or two lines of code.

Rich

*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #3  
Old   
Salad
 
Posts: n/a

Default Re: simulate keypress - 03-06-2008 , 12:54 PM



Daan wrote:

Quote:
Hello,

I have to start a Command_Click event with the simulation of pressing the
PgDown-key. Is this possible?

Private Sub Command_Click()
'press the PgDown - key
End Sub

Thanks


Private Sub Command1_Click()
SendKeys "{Enter}{pgdn}"
MsgBox "Beam me down, Scotty"
End Sub

Stretching
http://www.youtube.com/watch?v=DlP0XAifbm8


Reply With Quote
  #4  
Old   
Arno R
 
Posts: n/a

Default Re: simulate keypress - 03-06-2008 , 01:16 PM




"Salad" <oil (AT) vinegar (DOT) com> schreef in bericht news:13t0fg243upg606 (AT) corp (DOT) supernews.com...
Quote:
Private Sub Command1_Click()
SendKeys "{Enter}{pgdn}"
MsgBox "Beam me down, Scotty"
End Sub
I am guessing the OP only wanted Sendkeys "{PgDn}"

What's the PageDown 'doing' exactly ??
Maybe you can code 'the other way around' ??
e.g When moving to another page you might as well do a DoCmd.GoToPage 2
==> Be aware that Sendkeys will not work with Vista anymore.

Arno R


Reply With Quote
  #5  
Old   
Salad
 
Posts: n/a

Default Re: simulate keypress - 03-06-2008 , 02:28 PM



Arno R wrote:

Quote:
"Salad" <oil (AT) vinegar (DOT) com> schreef in bericht news:13t0fg243upg606 (AT) corp (DOT) supernews.com...

Private Sub Command1_Click()
SendKeys "{Enter}{pgdn}"
MsgBox "Beam me down, Scotty"
End Sub


I am guessing the OP only wanted Sendkeys "{PgDn}"
That's true. But if you don't give Sendkeys something to respond to it
simply sits there...waiting. I'm basically faking the thing out by
presenting a msgbox that the human eye would never see.

Miku
http://www.youtube.com/watch?v=XtsF3ZjkKvY


Quote:
What's the PageDown 'doing' exactly ??
Maybe you can code 'the other way around' ??
e.g When moving to another page you might as well do a DoCmd.GoToPage 2
==> Be aware that Sendkeys will not work with Vista anymore.

Arno R

Reply With Quote
Reply




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.