Results 1 to 2 of 2

Thread: Add New Record

  1. #1
    Join Date
    May 2002
    Posts
    12

    Unanswered: Add New Record

    I have two forms, both of which have different recordsource. One form is in the background of the other. When a user presses the F11 key, I want the form in the background to add a record and then be ready to add a new record. How do program this in VBA? Thanks

  2. #2
    Join Date
    Oct 2002
    Location
    NSW Australia
    Posts
    61

    Re: Add New Record

    Originally posted by Darkwingduck
    I have two forms, both of which have different recordsource. One form is in the background of the other. When a user presses the F11 key, I want the form in the background to add a record and then be ready to add a new record. How do program this in VBA? Thanks
    You need you catch the keystroke first and then do your function:
    -----------------------------------------
    Private Sub Form_Load()
    Me.KeyPreview = True
    End Sub

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case vbKeyF2
    ' Process F2 key events.
    Case vbKeyF3
    ' Process F3 key events.
    Case vbKeyF11
    ' Process F11 key events.
    DoCmd.GoToRecord acDataForm, "MyBackform", acNewRec
    Case Else
    End Select
    End Sub

    ---------------------
    Hope this helps !

Posting Permissions

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