Results 1 to 6 of 6
  1. #1
    accote is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Posts
    35

    Question Access Form Text Box Entry depending on Combo Box selection

    Hello Everyone

    I would think there would be a simple solution, but after hours of searching I have not found one yet.

    What I would like to do is have a form field (text box) auto populate a value depending on the selection of a combo box within the same form.

    Example: Combo Box Selection is "Prospect " and Text Box value would auto populate to "Opportunity"
    or: Combo Box Selection is "Client " and Text Box value would auto populate to "Clients"

    The Combo Box is named "Contact_Type" and the Text Box is named "Category"

    Basically I'm looking for an Expression or VBA Code that can do this, is this somehow possible? Any help would be greatly appreciated.



    Thank You

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    accote is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Posts
    35
    Thanks for your reply pbaldy, but that doesn't work as what I'm looking for is to add a new entry to the table with this form.
    The "Contact_Type" Combo Box only has about 6 choices, but the "Category" field can have different choices
    for the same Contact_Type depending on which form is being used.

    I was looking for something like an after update event of IIF([Contact_Type]="Prospect" Then [Category]="Opportunity") I tried all kinds of
    similar expressions but couldn't get any of them to work.

    Thank you for your help.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Well, you can look in help at the IIf() function to get the proper syntax, or with 6 choices the Switch() function might be easier.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    accote is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Posts
    35
    Hello All

    After playing with the Combo Box Scenario from pbaldy some more. I came up with making a Value List with 2 Columns of
    which I'm hiding the second Column which is the value I want added to my text box. Then I put in a After Update Event on
    the Combo Box that looks like This:

    Private Sub Contact_Type_AfterUpdate()
    Me.Contact_Type = Me.Contact_Type.Column(0)
    Me.Category = Me.Contact_Type.Column(1)
    End Sub

    And Voila it works. Thank you all for your help.

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    All of us were happy to help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 9
    Last Post: 07-20-2015, 10:55 AM
  2. Replies: 3
    Last Post: 03-15-2012, 02:27 PM
  3. Replies: 8
    Last Post: 01-25-2012, 02:07 PM
  4. Replies: 9
    Last Post: 05-30-2011, 01:52 PM
  5. Replies: 0
    Last Post: 12-02-2010, 11:59 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