KeyDown Event Problem

G

Guest

I have written the following sub for use on a form

Private Sub KDEVGJPScale(KeyCode As Integer, ctl As Access.OptionGroup
Select Case KeyCod
Case Asc("E"
ctl =
Case Asc("V"
ctl =
Case Asc("G"
ctl =
Case Asc("J"
ctl =
Case Asc("P"
ctl =
End Selec
End Su

The usage is in an option button's KeyDown Event, as such

Private Sub opt1_KeyDown(KeyCode As Integer, Shift As Integer
KDEVGJPScale KeyCode, Me.bytOverallEx
End Su

For some reason, whenever the event is fired from this (and all option buttons), if the selection is either "e" or "p" the same the next matching option group's result is also changed to "e" or "p". I have tried changing the letter, however this had no effect. As long as either the high or low value is selected, so it the following group's. In debugging, this doesn't actually occur until after the "End Sub" of the KeyDown event, so I'm at a loss to figure out why it is happening

Any suggestions? Also, if anything is unclear please post back and I'll try to explain further...it's just so strange it's hard to explain

Thanks
Jake
 
A

Albert D. Kallal

Does not pressing the letter jump to the first "label" that matches your
keypress?

If that keypress can be thrown into the black hole..I would consider doing
that.


Anway...I would try killing the key as follwos:

Private Sub KDEVGJPScale(KeyCode As Integer, ctl As Access.OptionGroup)
Select Case chr(KeyCode)
Case "E"
ctl = 5
KeyCode = 0
Case "V"
ctl = 4
KeyCode = 0

Etc...So, settting KeyCode = 0 means that ms-access will NOT get to see nor
process the key...
 
G

Guest

KeyCode = 0 worked like a charm...THANKS

Jak

----- Albert D. Kallal wrote: ----

Does not pressing the letter jump to the first "label" that matches you
keypress

If that keypress can be thrown into the black hole..I would consider doin
that


Anway...I would try killing the key as follwos

Private Sub KDEVGJPScale(KeyCode As Integer, ctl As Access.OptionGroup
Select Case chr(KeyCode
Case "E
ctl =
KeyCode =
Case "V
ctl =
KeyCode =

Etc...So, settting KeyCode = 0 means that ms-access will NOT get to see no
process the key..


-
Albert D. Kallal (MVP
Edmonton, Alberta Canad
(e-mail address removed)
http://www.attcanada.net/~kallal.ms
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top