dbTalk Databases Forums  

KeyAscii in property window

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


Discuss KeyAscii in property window in the comp.databases.ms-access forum.



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

Default KeyAscii in property window - 01-06-2005 , 08:10 AM






In a field's OnKeyPress properties I can execute code that reveals the
Ascii key that is pressed:

On Key Press: [Event Procedure]

Private Sub FieldName_KeyPress(KeyAscii As Integer)
Dim x as Integer
If KeyAscii = x then Call RunSomeFunction
End Sub

Is it possible to do the same if I call the function from the property
window of the control:

On Key Press: =RunSomeOtherFunction(???KeyAscii???)

Function RunSomeOtherFunction(KeyAscii As Integer)
Dim x as Integer
If KeyAscii = x then
call RunSomeExcitingCode
End If
End Function


Reply With Quote
  #2  
Old   
Terry Kreft
 
Posts: n/a

Default Re: KeyAscii in property window - 01-06-2005 , 08:17 AM






If RunSomeOtherFunction is declared as shown below in a module then you can
run it from the immediate window like this

?RunSomeOtherFunction(Asc("A"))


Where Asc is a function which returns the ASCII value of the first character
in the string passed to it.

--
Terry Kreft
MVP Microsoft Access


"laurenq uantrell" <laurenquantrell (AT) hotmail (DOT) com> wrote

Quote:
In a field's OnKeyPress properties I can execute code that reveals the
Ascii key that is pressed:

On Key Press: [Event Procedure]

Private Sub FieldName_KeyPress(KeyAscii As Integer)
Dim x as Integer
If KeyAscii = x then Call RunSomeFunction
End Sub

Is it possible to do the same if I call the function from the property
window of the control:

On Key Press: =RunSomeOtherFunction(???KeyAscii???)

Function RunSomeOtherFunction(KeyAscii As Integer)
Dim x as Integer
If KeyAscii = x then
call RunSomeExcitingCode
End If
End Function




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

Default Re: KeyAscii in property window - 01-06-2005 , 11:04 AM



laurenq uantrell wrote:

Quote:
In a field's OnKeyPress properties I can execute code that reveals the
Ascii key that is pressed:

On Key Press: [Event Procedure]

Private Sub FieldName_KeyPress(KeyAscii As Integer)
Dim x as Integer
If KeyAscii = x then Call RunSomeFunction
End Sub

Is it possible to do the same if I call the function from the property
window of the control:

On Key Press: =RunSomeOtherFunction(???KeyAscii???)

Function RunSomeOtherFunction(KeyAscii As Integer)
Dim x as Integer
If KeyAscii = x then
call RunSomeExcitingCode
End If
End Function

Doubtful. KeyAscii is an argument passed to the OnKeyPress event by
Access.


Reply With Quote
  #4  
Old   
laurenq uantrell
 
Posts: n/a

Default Re: KeyAscii in property window - 01-06-2005 , 05:19 PM



Terry,
Thanks for the reply.
I was hoping there is a way to crack what seems to be built-in
functions in Access that expose the KeyAscii value and other values
that reveal themselves only when exposed through the event procedure.
lq


Terry Kreft wrote:
Quote:
If RunSomeOtherFunction is declared as shown below in a module then
you can
run it from the immediate window like this

?RunSomeOtherFunction(Asc("A"))


Where Asc is a function which returns the ASCII value of the first
character
in the string passed to it.

--
Terry Kreft
MVP Microsoft Access


"laurenq uantrell" <laurenquantrell (AT) hotmail (DOT) com> wrote in message
news:1105020619.117652.263760 (AT) c13g2000cwb (DOT) googlegroups.com...
In a field's OnKeyPress properties I can execute code that reveals
the
Ascii key that is pressed:

On Key Press: [Event Procedure]

Private Sub FieldName_KeyPress(KeyAscii As Integer)
Dim x as Integer
If KeyAscii = x then Call RunSomeFunction
End Sub

Is it possible to do the same if I call the function from the
property
window of the control:

On Key Press: =RunSomeOtherFunction(???KeyAscii???)

Function RunSomeOtherFunction(KeyAscii As Integer)
Dim x as Integer
If KeyAscii = x then
call RunSomeExcitingCode
End If
End Function



Reply With Quote
  #5  
Old   
Terry Kreft
 
Posts: n/a

Default Re: KeyAscii in property window - 01-07-2005 , 03:35 AM



Ah, right, I went back and re-read your OP I missed the property page part.

No, it's not possible.

Think of the property page as being a higher level than the procedure, at
the property page level you can choose to
a) run a specific function
b) build an expression
c) execute the appropriate event for the control

These are three distinct choices, the KeyAscii value of the key pressed is
only exposed in the event.


--
Terry Kreft
MVP Microsoft Access


"laurenq uantrell" <laurenquantrell (AT) hotmail (DOT) com> wrote

Quote:
Terry,
Thanks for the reply.
I was hoping there is a way to crack what seems to be built-in
functions in Access that expose the KeyAscii value and other values
that reveal themselves only when exposed through the event procedure.
lq


Terry Kreft wrote:
If RunSomeOtherFunction is declared as shown below in a module then
you can
run it from the immediate window like this

?RunSomeOtherFunction(Asc("A"))


Where Asc is a function which returns the ASCII value of the first
character
in the string passed to it.

--
Terry Kreft
MVP Microsoft Access


"laurenq uantrell" <laurenquantrell (AT) hotmail (DOT) com> wrote in message
news:1105020619.117652.263760 (AT) c13g2000cwb (DOT) googlegroups.com...
In a field's OnKeyPress properties I can execute code that reveals
the
Ascii key that is pressed:

On Key Press: [Event Procedure]

Private Sub FieldName_KeyPress(KeyAscii As Integer)
Dim x as Integer
If KeyAscii = x then Call RunSomeFunction
End Sub

Is it possible to do the same if I call the function from the
property
window of the control:

On Key Press: =RunSomeOtherFunction(???KeyAscii???)

Function RunSomeOtherFunction(KeyAscii As Integer)
Dim x as Integer
If KeyAscii = x then
call RunSomeExcitingCode
End If
End Function





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.