Results 1 to 4 of 4
  1. #1
    MrDean is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    2

    On Click Event Procedure

    Hello all. Newbie to the site so please be gentle!

    Ok, form question for you.

    I have a form that uses several buttons that when clicked, will send the user to a new form. Fine, lovely stuff. What I would like to do, is set up the on click so that it takes one of the fields on the current record on the one form into account and uses this as a reference to go to the second form.

    So for example, I have Form 1 featuring client ID, client name, staff member as fields. On Form 2, I have staff member, address, telephone number.

    If I click on the button in Form 1, in this case, staff details, this would take the user to Form 2 but focus on look at the staff member currently present in Form 1.

    Currently the syntax is this:

    Private Sub Current_Staff_Detail_Click()
    On Error GoTo Err_Current_Staff_Detail_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "tblIndividualStaff"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Exit_Current_Staff_Detail_Click:
    Exit Sub


    Err_Current_Staff_Detail_Click:
    MsgBox Err.Description
    Resume Exit_Current_Staff_Detail_Click

    End Sub

    I strongly suspect I have to insert an "On Current" focus or something like that but being a bit thick, I 'm npot sure how to proceed.

    If anyone can assist me in this, I will be extremely grateful

    Rich

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    See if this link helps a bit.

  3. #3
    MrDean is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    2
    Top stuff...just what I was after.

    Thanks very much

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad to help. Are you ready to use the Solved thread tool yet? Follow the link in my sig if you are.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to run VBA procedure
    By bkelly in forum Programming
    Replies: 8
    Last Post: 09-26-2009, 06:08 PM
  2. how to call a sub procedure?
    By dollygg in forum Access
    Replies: 1
    Last Post: 08-18-2009, 05:10 AM
  3. Replies: 21
    Last Post: 06-03-2009, 05:54 PM
  4. On-Click event transfer
    By nkenney in forum Forms
    Replies: 16
    Last Post: 03-26-2009, 09:02 PM
  5. Troubleshoot NotInList Event Procedure
    By skyrise in forum Programming
    Replies: 4
    Last Post: 02-23-2009, 06:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums