Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004

    Unanswered: Autokeys condition

    hi all

    Does anyone know if it's possible to set a condition for autokeys, for example

    F1 = if [form1] open then msbox "complete form 1" else docmd [form2].open

    somehting like?

  2. #2
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    Private Sub Form_Load()
        Me.KeyPreview = True
    End Sub
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
        Select Case KeyCode
            Case vbKeyF1
                If Form1 is open Then
                   MsgBox "Complete Form 1!!!"
                   KeyCode = 0
                   Open Form2
                   KeyCode = 0
                End If
            Case vbKeyF3
                ' Process F3 key events.
            Case vbKeyF4
                ' Process F4 key events.
            Case Else
        End Select
    End Sub
    With the appropriate commands in place of the italicized text, of course.

    You really should leave the F1 key alone, as it is the universal HELP key. I'm confused about the logic here! Where are you going to put this code?
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Mar 2004
    Should do the trick, thanks very much.

    i am running a point of sale, stock control, customer file and cash reconciliation application in multiple sites.

    i use all off the function keys to allow users to acces different menu items.

    as part of the end of day process the app runs though a banking routine with users inputting data via a form, it is critical that no ther data is entered until this process is complete. hence the msgbox on functionkeys event.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts