Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Function keys


Message #1 by "e n z o" <enzaux@y...> on Sat, 23 Feb 2002 03:52:36 +0800

This is a multi-part message in MIME format.



------=_NextPart_000_0069_01C1BC1D.87F63E60

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable





    Hi!!  I was wondering why is it that vbkey Function keys are not 

working on my code.   What I was trying to do is that anytime a user 

wants to open Form1 he'll just press F1 and for Form2 is by pressing F2.



    Now what I did is I made my code in the Keypress event of the form 

and setting the Key Preview to YES.  vbKeyEscape is recognized on my 

code but when I try to detect if the user keyed in F1 or F2 it won't.  A 

chunk of my code is here:



Private Sub frmMain_KeyPress(KeyAscii as Integer)



 Select Case KeyAscii

  Case vbKeyEscape:

                   msgbox "Escape key is WOrking"

 Case vbKeyF1:

                   msgbox "F1 key is WOrking"

 Case vbKeyF2:

                   msgbox "F2 key is WOrking"

End Select



End Sub



    Only the vbKeyEscape is only recognized but when I try to press F1 

or F2 nothing happens.  I tried also some other vbkeys and still it 

won't work except for vbKeyEscape.  Any explanation on this?  Thanks!!!





Thanks/Regards,



Enzo






Message #2 by "John Ruff" <papparuff@c...> on Fri, 22 Feb 2002 15:19:02 -0800
This is a multi-part message in MIME format.



------=_NextPart_000_001C_01C1BBB4.43034640

Content-Type: text/plain;

	charset="US-ASCII"

Content-Transfer-Encoding: 7bit



Enzo,

 

Open Help, enter the word autokeys in the Answer Wizard.  I believe this

will solve your problem.

 

John Ruff - The Eternal Optimist J



Always looking for Contract Opportunities



 



9306 Farwest Dr SW



Lakewood, WA 98498



papparuff@c...



-----Original Message-----

From: e n z o [mailto:enzaux@y...] 

Sent: Friday, February 22, 2002 11:53 AM

To: Access

Subject: [access] Function keys





 

    Hi!!  I was wondering why is it that vbkey Function keys are not

working on my code.   What I was trying to do is that anytime a user

wants to open Form1 he'll just press F1 and for Form2 is by pressing F2.

 

    Now what I did is I made my code in the Keypress event of the form

and setting the Key Preview to YES.  vbKeyEscape is recognized on my

code but when I try to detect if the user keyed in F1 or F2 it won't.  A

chunk of my code is here:

 

Private Sub frmMain_KeyPress(KeyAscii as Integer)

 

 Select Case KeyAscii

  Case vbKeyEscape:

                   msgbox "Escape key is WOrking"

 Case vbKeyF1:

                   msgbox "F1 key is WOrking"

 Case vbKeyF2:

                   msgbox "F2 key is WOrking"

End Select

 

End Sub

 

    Only the vbKeyEscape is only recognized but when I try to press F1

or F2 nothing happens.  I tried also some other vbkeys and still it

won't work except for vbKeyEscape.  Any explanation on this?  Thanks!!!

 

 

Thanks/Regards,

 

Enzo











Message #3 by "John Ruff" <papparuff@c...> on Fri, 22 Feb 2002 16:01:17 -0800
This is a multi-part message in MIME format.



------=_NextPart_000_0023_01C1BBBA.299B2870

Content-Type: text/plain;

	charset="US-ASCII"

Content-Transfer-Encoding: 7bit



Enzo,

 

I apologize, I should have gone into more detail.  

 

If you create an Autokeys Macro and set any of Access' default keys to

do what you want them to do, then Access's default function will be

overridden.  For example; if F1 is assigned the task of opening a form

in the Autokeys Macro, then when F1 is pressed the form will open.  If

you create code to have F1 open a form, it will not only open the form,

it will also open Access' Help Screen.

 

Here's how to test what I'm saying.

 

Create a new macro and in the Macro Name column enter {F1}.  In the

Action column enter OpenForm and specify the form you want opened when

you press F1.  Save the macro as Autokeys then close the database and

reopen it

 

If you press F1, the form that you told the key to open through the

Autokeys macro will open.

 

The Autokey Macro initializes as soon as the database opens and resides

in memroy until the database is closed.  the Autokey Macro also tells

Access that when any key or key combination in the Autokey macro is

selected, perform the functions in the macro.  If any of the keys or key

combinations in the macro are also Default Access keys' then Access is

to ignore the defaults..

 

Now, rename the Autokeys macro to Autokeys1 and close and open the

database to clear the Autokeys macro from memory.

 

Create a blank form and set it's Key Preview property to Yes.

 

On the form's Key Down event enter the following code:



Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

    

    Select Case KeyCode

        Case vbKeyF1

            DoCmd.OpenForm "YourFormNameHere"

        Case vbKeyF2

            MsgBox "F2 was pressed"

    End Select

 

End Sub



Save the form as frmTest.

 

Open the form and press the F1 key.  You will now notice that not only

does the form specified in the Form Key Press event open, but Access'

Help window opens.

 

For this reason, I would suggest using the Autokey macro if you want to

assign specific keys or key combinations to perform specific tasks.

 



John Ruff - The Eternal Optimist J



Always looking for Contract Opportunities



 



9306 Farwest Dr SW



Lakewood, WA 98498



papparuff@c...



-----Original Message-----

From: e n z o [mailto:enzaux@y...] 

Sent: Friday, February 22, 2002 11:53 AM

To: Access

Subject: [access] Function keys





 

    Hi!!  I was wondering why is it that vbkey Function keys are not

working on my code.   What I was trying to do is that anytime a user

wants to open Form1 he'll just press F1 and for Form2 is by pressing F2.

 

    Now what I did is I made my code in the Keypress event of the form

and setting the Key Preview to YES.  vbKeyEscape is recognized on my

code but when I try to detect if the user keyed in F1 or F2 it won't.  A

chunk of my code is here:

 

Private Sub frmMain_KeyPress(KeyAscii as Integer)

 

 Select Case KeyAscii

  Case vbKeyEscape:

                   msgbox "Escape key is WOrking"

 Case vbKeyF1:

                   msgbox "F1 key is WOrking"

 Case vbKeyF2:

                   msgbox "F2 key is WOrking"

End Select

 

End Sub

 

    Only the vbKeyEscape is only recognized but when I try to press F1

or F2 nothing happens.  I tried also some other vbkeys and still it

won't work except for vbKeyEscape.  Any explanation on this?  Thanks!!!

 

 

Thanks/Regards,

 

Enzo











Message #4 by "Randy Cornish" <rlcornish@c...> on Sat, 23 Feb 2002 18:49:27
vbKeyF1 (and so on) are not ASCII codes).  You will need to trap your 

code in the KeyUp or KeyDown events.  For example, F1 = KeyCode of 112 = 

vbKeyF1.



R



 

>     Hi!!  I was wondering why is it that vbkey Function keys are not 

> working on my code.   What I was trying to do is that anytime a user 

> wants to open Form1 he'll just press F1 and for Form2 is by pressing F2.

> 

>     Now what I did is I made my code in the Keypress event of the form 

> and setting the Key Preview to YES.  vbKeyEscape is recognized on my 

> code but when I try to detect if the user keyed in F1 or F2 it won't.  

A 

> chunk of my code is here:

> 

> Private Sub frmMain_KeyPress(KeyAscii as Integer)

> 

>  Select Case KeyAscii

>   Case vbKeyEscape:

>                    msgbox "Escape key is WOrking"

>  Case vbKeyF1:

>                    msgbox "F1 key is WOrking"

>  Case vbKeyF2:

>                    msgbox "F2 key is WOrking"

> End Select

> 

> End Sub

> 

>     Only the vbKeyEscape is only recognized but when I try to press F1 

> or F2 nothing happens.  I tried also some other vbkeys and still it 

> won't work except for vbKeyEscape.  Any explanation on this?  Thanks!!!

> 

> 

> Thanks/Regards,

> 

> Enzo

Message #5 by "e n z o" <enzaux@y...> on Sun, 24 Feb 2002 18:20:34 +0800
Thanks guys!!!  I think I will think twice on using this method.  But

anyways may be I'll trying doing buttons instead and making this invisible.



Thank you all, esp John Ruff that was a great sample :)



Enzo :)



----- Original Message -----

From: "Randy Cornish" <rlcornish@c...>

To: "Access" <access@p...>

Sent: Saturday, February 23, 2002 6:49 PM

Subject: [access] Re: Function keys





> vbKeyF1 (and so on) are not ASCII codes).  You will need to trap your

> code in the KeyUp or KeyDown events.  For example, F1 = KeyCode of 112 

> vbKeyF1.

>

> R

>

>

> >     Hi!!  I was wondering why is it that vbkey Function keys are not 

> > working on my code.   What I was trying to do is that anytime a user 

> > wants to open Form1 he'll just press F1 and for Form2 is by pressing F2.

> >

> >     Now what I did is I made my code in the Keypress event of the form 

> > and setting the Key Preview to YES.  vbKeyEscape is recognized on my 

> > code but when I try to detect if the user keyed in F1 or F2 it won't.

> A 

> > chunk of my code is here:

> >

> > Private Sub frmMain_KeyPress(KeyAscii as Integer)

> >

> >  Select Case KeyAscii

> >   Case vbKeyEscape:

> >                    msgbox "Escape key is WOrking"

> >  Case vbKeyF1:

> >                    msgbox "F1 key is WOrking"

> >  Case vbKeyF2:

> >                    msgbox "F2 key is WOrking"

> > End Select

> >

> > End Sub

> >

> >     Only the vbKeyEscape is only recognized but when I try to press F1 

> > or F2 nothing happens.  I tried also some other vbkeys and still it 

> > won't work except for vbKeyEscape.  Any explanation on this?  Thanks!!!

> >

> >

> > Thanks/Regards,

> >

> > Enzo

>






Message #6 by "e n z o" <enzaux@y...> on Sun, 24 Feb 2002 18:37:32 +0800

This is a multi-part message in MIME format.



------=_NextPart_000_01D6_01C1BD62.52694580

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



MessageWow Autokeys did work!!!!!  This is exactly what I need.  Any 

disadvantages of using this method?  or any consequences in using this 

method?



thanks,



enzo :)

  ----- Original Message -----

  From: John Ruff

  To: Access

  Sent: Saturday, February 23, 2002 8:01 AM

  Subject: [access] RE: Function keys





  Enzo,



  I apologize, I should have gone into more detail. 



  If you create an Autokeys Macro and set any of Access' default keys to 

do what you want them to do, then Access's default function will be 

overridden.  For example; if F1 is assigned the task of opening a form 

in the Autokeys Macro, then when F1 is pressed the form will open.  If 

you create code to have F1 open a form, it will not only open the form, 

it will also open Access' Help Screen.



  Here's how to test what I'm saying.



  Create a new macro and in the Macro Name column enter {F1}.  In the 

Action column enter OpenForm and specify the form you want opened when 

you press F1.  Save the macro as Autokeys then close the database and 

reopen it



  If you press F1, the form that you told the key to open through the 

Autokeys macro will open.



  The Autokey Macro initializes as soon as the database opens and 

resides in memroy until the database is closed.  the Autokey Macro also 

tells Access that when any key or key combination in the Autokey macro 

is selected, perform the functions in the macro.  If any of the keys or 

key combinations in the macro are also Default Access keys' then Access 

is to ignore the defaults..



  Now, rename the Autokeys macro to Autokeys1 and close and open the 

database to clear the Autokeys macro from memory.



  Create a blank form and set it's Key Preview property to Yes.



  On the form's Key Down event enter the following code:



  Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

     

      Select Case KeyCode

          Case vbKeyF1

              DoCmd.OpenForm "YourFormNameHere"

          Case vbKeyF2

              MsgBox "F2 was pressed"

      End Select

  

  End Sub



  Save the form as frmTest.



  Open the form and press the F1 key.  You will now notice that not only 

does the form specified in the Form Key Press event open, but Access' 

Help window opens.



  For this reason, I would suggest using the Autokey macro if you want 

to assign specific keys or key combinations to perform specific tasks.



  John Ruff - The Eternal Optimist J



  Always looking for Contract Opportunities



  



  9306 Farwest Dr SW



  Lakewood, WA 98498



  papparuff@c...



    -----Original Message-----

    From: e n z o [mailto:enzaux@y...]

    Sent: Friday, February 22, 2002 11:53 AM

    To: Access

    Subject: [access] Function keys







        Hi!!  I was wondering why is it that vbkey Function keys are not 

working on my code.   What I was trying to do is that anytime a user 

wants to open Form1 he'll just press F1 and for Form2 is by pressing F2.



        Now what I did is I made my code in the Keypress event of the 

form and setting the Key Preview to YES.  vbKeyEscape is recognized on 

my code but when I try to detect if the user keyed in F1 or F2 it won't. 

 A chunk of my code is here:



    Private Sub frmMain_KeyPress(KeyAscii as Integer)



     Select Case KeyAscii

      Case vbKeyEscape:

                       msgbox "Escape key is WOrking"

     Case vbKeyF1:

                       msgbox "F1 key is WOrking"

     Case vbKeyF2:

                       msgbox "F2 key is WOrking"

    End Select



    End Sub



        Only the vbKeyEscape is only recognized but when I try to press 

F1 or F2 nothing happens.  I tried also some other vbkeys and still it 

won't work except for vbKeyEscape.  Any explanation on this?  Thanks!!!





    Thanks/Regards,



    Enzo




$subst('Email.Unsub').




$subst('Email.Unsub').






Message #7 by "John Ruff" <papparuff@c...> on Sun, 24 Feb 2002 08:32:20 -0800
This is a multi-part message in MIME format.



------=_NextPart_000_0023_01C1BD0D.C6D97890

Content-Type: text/plain;

	charset="US-ASCII"

Content-Transfer-Encoding: 7bit



It's all a matter of preference.  Just remember that if you assign an

Access hot-key like F1 to a function through the Autokeys macro, then

Help is no longer available by pressing F1.

 



John Ruff - The Eternal Optimist J



Always looking for Contract Opportunities



 



9306 Farwest Dr SW



Lakewood, WA 98498



papparuff@c...



-----Original Message-----

From: e n z o [mailto:enzaux@y...] 

Sent: Sunday, February 24, 2002 2:38 AM

To: Access

Subject: [access] RE: Function keys





Wow Autokeys did work!!!!!  This is exactly what I need.  Any

disadvantages of using this method?  or any consequences in using this

method?

 

thanks,

 

enzo :)



----- Original Message ----- 

From: John Ruff <mailto:papparuff@c...>  

To: Access <mailto:access@p...>  

Sent: Saturday, February 23, 2002 8:01 AM

Subject: [access] RE: Function keys



Enzo,

 

I apologize, I should have gone into more detail.  

 

If you create an Autokeys Macro and set any of Access' default keys to

do what you want them to do, then Access's default function will be

overridden.  For example; if F1 is assigned the task of opening a form

in the Autokeys Macro, then when F1 is pressed the form will open.  If

you create code to have F1 open a form, it will not only open the form,

it will also open Access' Help Screen.

 

Here's how to test what I'm saying.

 

Create a new macro and in the Macro Name column enter {F1}.  In the

Action column enter OpenForm and specify the form you want opened when

you press F1.  Save the macro as Autokeys then close the database and

reopen it

 

If you press F1, the form that you told the key to open through the

Autokeys macro will open.

 



The Autokey Macro initializes as soon as the database opens and resides

in memroy until the database is closed.  the Autokey Macro also tells

Access that when any key or key combination in the Autokey macro is

selected, perform the functions in the macro.  If any of the keys or key

combinations in the macro are also Default Access keys' then Access is

to ignore the defaults..

 

Now, rename the Autokeys macro to Autokeys1 and close and open the

database to clear the Autokeys macro from memory.

 

Create a blank form and set it's Key Preview property to Yes.

 

On the form's Key Down event enter the following code:





Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

    

    Select Case KeyCode

        Case vbKeyF1

            DoCmd.OpenForm "YourFormNameHere"

        Case vbKeyF2

            MsgBox "F2 was pressed"

    End Select

 

End Sub



Save the form as frmTest.

 

Open the form and press the F1 key.  You will now notice that not only

does the form specified in the Form Key Press event open, but Access'

Help window opens.

 

For this reason, I would suggest using the Autokey macro if you want to

assign specific keys or key combinations to perform specific tasks.

 



John Ruff - The Eternal Optimist J



Always looking for Contract Opportunities



 



9306 Farwest Dr SW



Lakewood, WA 98498



papparuff@c...



-----Original Message-----

From: e n z o [mailto:enzaux@y...] 

Sent: Friday, February 22, 2002 11:53 AM

To: Access

Subject: [access] Function keys





 

    Hi!!  I was wondering why is it that vbkey Function keys are not

working on my code.   What I was trying to do is that anytime a user

wants to open Form1 he'll just press F1 and for Form2 is by pressing F2.

 

    Now what I did is I made my code in the Keypress event of the form

and setting the Key Preview to YES.  vbKeyEscape is recognized on my

code but when I try to detect if the user keyed in F1 or F2 it won't.  A

chunk of my code is here:

 

Private Sub frmMain_KeyPress(KeyAscii as Integer)

 

 Select Case KeyAscii

  Case vbKeyEscape:

                   msgbox "Escape key is WOrking"

 Case vbKeyF1:

                   msgbox "F1 key is WOrking"

 Case vbKeyF2:

                   msgbox "F2 key is WOrking"

End Select

 

End Sub

 

    Only the vbKeyEscape is only recognized but when I try to press F1

or F2 nothing happens.  I tried also some other vbkeys and still it

won't work except for vbKeyEscape.  Any explanation on this?  Thanks!!!

 

 

Thanks/Regards,

 

Enzo





















Message #8 by "e n z o" <enzaux@y...> on Tue, 26 Feb 2002 21:07:50 +0800

This is a multi-part message in MIME format.



------=_NextPart_000_0040_01C1BF09.A61DB460

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



MessageEy!!!!  thanks man!!!  I have a read an Access book developer's 

guide and I found a chapter that discusses the autokeys thanks for 

letting me know about this thing.  I wouldn't know that this is possible 

without you telling me :)  I have also discovered AutoExec but what the 

hell we can run anyform in the Startup option anyway :)



Thanks,



Enzo :)

  ----- Original Message -----

  From: John Ruff

  To: Access

  Sent: Monday, February 25, 2002 12:32 AM

  Subject: [access] RE: Function keys





  It's all a matter of preference.  Just remember that if you assign an 

Access hot-key like F1 to a function through the Autokeys macro, then 

Help is no longer available by pressing F1.



  John Ruff - The Eternal Optimist J



  Always looking for Contract Opportunities



  



  9306 Farwest Dr SW



  Lakewood, WA 98498



  papparuff@c...



    -----Original Message-----

    From: e n z o [mailto:enzaux@y...]

    Sent: Sunday, February 24, 2002 2:38 AM

    To: Access

    Subject: [access] RE: Function keys





    Wow Autokeys did work!!!!!  This is exactly what I need.  Any 

disadvantages of using this method?  or any consequences in using this 

method?



    thanks,



    enzo :)

      ----- Original Message -----

      From: John Ruff

      To: Access

      Sent: Saturday, February 23, 2002 8:01 AM

      Subject: [access] RE: Function keys





      Enzo,



      I apologize, I should have gone into more detail. 



      If you create an Autokeys Macro and set any of Access' default 

keys to do what you want them to do, then Access's default function will 

be overridden.  For example; if F1 is assigned the task of opening a 

form in the Autokeys Macro, then when F1 is pressed the form will open.  

If you create code to have F1 open a form, it will not only open the 

form, it will also open Access' Help Screen.



      Here's how to test what I'm saying.



      Create a new macro and in the Macro Name column enter {F1}.  In 

the Action column enter OpenForm and specify the form you want opened 

when you press F1.  Save the macro as Autokeys then close the database 

and reopen it



      If you press F1, the form that you told the key to open through 

the Autokeys macro will open.



      The Autokey Macro initializes as soon as the database opens and 

resides in memroy until the database is closed.  the Autokey Macro also 

tells Access that when any key or key combination in the Autokey macro 

is selected, perform the functions in the macro.  If any of the keys or 

key combinations in the macro are also Default Access keys' then Access 

is to ignore the defaults..



      Now, rename the Autokeys macro to Autokeys1 and close and open the 

database to clear the Autokeys macro from memory.



      Create a blank form and set it's Key Preview property to Yes.



      On the form's Key Down event enter the following code:



      Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

         

          Select Case KeyCode

              Case vbKeyF1

                  DoCmd.OpenForm "YourFormNameHere"

              Case vbKeyF2

                  MsgBox "F2 was pressed"

          End Select

      

      End Sub



      Save the form as frmTest.



      Open the form and press the F1 key.  You will now notice that not 

only does the form specified in the Form Key Press event open, but 

Access' Help window opens.



      For this reason, I would suggest using the Autokey macro if you 

want to assign specific keys or key combinations to perform specific 

tasks.



      John Ruff - The Eternal Optimist J



      Always looking for Contract Opportunities



      



      9306 Farwest Dr SW



      Lakewood, WA 98498



      papparuff@c...



        -----Original Message-----

        From: e n z o [mailto:enzaux@y...]

        Sent: Friday, February 22, 2002 11:53 AM

        To: Access

        Subject: [access] Function keys







            Hi!!  I was wondering why is it that vbkey Function keys are 

not working on my code.   What I was trying to do is that anytime a user 

wants to open Form1 he'll just press F1 and for Form2 is by pressing F2.



            Now what I did is I made my code in the Keypress event of 

the form and setting the Key Preview to YES.  vbKeyEscape is recognized 

on my code but when I try to detect if the user keyed in F1 or F2 it 

won't.  A chunk of my code is here:



        Private Sub frmMain_KeyPress(KeyAscii as Integer)



         Select Case KeyAscii

          Case vbKeyEscape:

                           msgbox "Escape key is WOrking"

         Case vbKeyF1:

                           msgbox "F1 key is WOrking"

         Case vbKeyF2:

                           msgbox "F2 key is WOrking"

        End Select



        End Sub



            Only the vbKeyEscape is only recognized but when I try to 

press F1 or F2 nothing happens.  I tried also some other vbkeys and 

still it won't work except for vbKeyEscape.  Any explanation on this?  

Thanks!!!





        Thanks/Regards,



        Enzo




$subst('Email.Unsub').




$subst('Email.Unsub').




$subst('Email.Unsub').




$subst('Email.Unsub').







  Return to Index