Results 1 to 3 of 3
  1. #1
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352

    Question Autofill text with a word based on combo selection

    Want to autofill a textbox with a choice of two words based on a combo box selection.
    Combo1 selects an area and product name
    Text1 has a product type.


    The criteria is as such:
    If the selection from Combo1 has the words "CDW" in it then Text1 should autofill with "Clorox"
    If the selection from Combo1 has the words "AAG" in it then Text1 should autofill with "AAG"
    There is no possibility for overlap.
    Current code: Text1 always displays AAG only.
    Code:
    Private Sub cboCell_AfterUpdate()
    If Me.cboCell.Value = "*CDW*" Then
    Me.txtProduct.Value = "Clorox"
    ElseIf Me.cboCell.Value = "*AAG*" Then
    Me.txtProduct.Value = "AAG"
    End If
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Are you saving the combobox value? Why save calculated value? It can be calculated when needed.

    Wildcards are useless without LIKE operator.

    Private Sub cboCell_AfterUpdate()
    If Me.cboCell LIKE "*CDW*" Then
    Me.txtProduct = "Clorox"
    ElseIf Me.cboCell LIKE "*AAG*" Then
    Me.txtProduct = "AAG"
    End If
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Will be saved, yes.

    I am using this to make it easier for the user to quickly fill out the form (to report a disruption) while on the production floor.

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

Similar Threads

  1. Replies: 2
    Last Post: 08-22-2014, 01:20 PM
  2. Replies: 9
    Last Post: 05-23-2014, 04:18 PM
  3. Replies: 1
    Last Post: 12-10-2013, 06:27 AM
  4. Replies: 3
    Last Post: 03-15-2012, 02:27 PM
  5. Replies: 8
    Last Post: 01-25-2012, 02:07 PM

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