Results 1 to 4 of 4
  1. #1
    athomas8251 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    10

    One control with two "afterupdate" requirements.

    I have an Order Form using cascading combo boxes using very simple VBA.

    • The first combo box called "PayorType", filters the second combo box called "PayorID".
    • There are four PayorType value selections: Insurance, Employer, Self, Other
    Private Sub cboPayorType_AfterUpdate()
    cboPayorID.RowSource = "Select tblPayors.PayorID, ..... etc etc. "
    "FROM tblPayors " & _
    "WHERE tblPayors.PayorType = '" & cboPayorType.Value & "' " & _
    "ORDER BY tblPayors.PayorID;"
    End Sub

    Now that I've got that working..... my next step is to make sure users fill out the four fields of health insurance information (InsuredName, RelationshipTo, PolicyNumber, GroupNumber) if "Insurance" PayorType is chosen.

    From what I can gather after researching, this appears to be an AfterUpdate action on the same PayorType control.



    Is it possible to have two actions on one control AfterUpdate? If so, I would first run the VBA to filter the cascading combo box. Second, I would want the focus to go to the InsuredName field if PayorType = "Insurance" - otherwise, skip to the Order Detail subform.

    If this isn't impossible, I'd just be happy if there is a way to pop up a message box based on PayorType ="Insurance" before the form closes.

    Thank you for your attention!

    Andi

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    There is no limit on how much you can do in the AfterUpdate event of a control. That includes moving the focus to the next control on *your* choice.

  3. #3
    athomas8251 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    10
    Thanks RG! That's great to know. I've not done this before (although I've been pretty good at looking at other code and adapting it).

    If cboPayorType = "Insurance", focus on the InsuredName control and require data in InsuredName, RelationshipTo, PolicyNumber, and GroupNumber fields.

    If cboPayorType = is not "Insurance", skip.

    Help? I'd be happy to send you the DB. Please let me know.

    Best,

    Andi

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You will need to enforce the required fields in the BeforeUpdate event of the Form but moving the focus is as simple as:
    If Me.cboPayorType = "Insurance" Then
    Me.InsuredName.SetFocus
    Else
    Me.OtherControl.SetFocus
    End If

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

Similar Threads

  1. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  2. Replies: 3
    Last Post: 03-21-2011, 05:29 PM
  3. "AfterUpdate" issue
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 03-04-2011, 01:46 PM
  4. "AfterUpdate" for tables ??
    By imranp in forum Programming
    Replies: 1
    Last Post: 02-10-2011, 11:08 AM
  5. Replies: 1
    Last Post: 10-19-2009, 02:37 AM

Tags for this Thread

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