By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

KeyAscii in property window

P: n/a
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

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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" <la*************@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.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

Nov 13 '05 #2

P: n/a
laurenq uantrell wrote:
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.
Nov 13 '05 #3

P: n/a
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" <la*************@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.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


Nov 13 '05 #4

P: n/a
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" <la*************@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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" <la*************@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.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

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.