Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2013
    Posts
    1

    Exclamation Unanswered: Autofill from combo box with large description

    Hi, I have very basic knowledge of access, but I am currently trying to put together a risk analysis database. I wanted to have a combo box for my risk categories and then have the description of that particular risk pop up in the text box below. I tried going into VBA and using the me.txtname=me.comboname.column (1), and yes I did all the steps to get that particular code working. My major problem is that my descriptions are too long to fit into the combo box (column 1), but I need the full description for each scenario. Is there any other way to do this?
    Thanks for the help!

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Instead of including the Memo Field in the Combobox, you need to use the DLookup function, using Criteria to tell the Access Gnomes which Record to pull the Memo Field data from:

    Where the First Field/Column in the Combobox is
    • A Unique Identifying Field for the Record (such as an ID Number)
    • The Bound Field for the Combobox
    and where
    • UniqueIdentifier is the name of the Field in the Table

    ' If the UniqueIdentifier is Text
    Code:
    Private Sub ComboBoxName_BeforeUpdate(Cancel As Integer)
      Me. MemoFieldTextBox = DLookup("MemoFieldName", "TableName", "[UniqueIdentifier]= '" & Me.ComboBoxName & "'")
    End Sub


    ' If the UniqueIdentifier is Numeric
    Code:
    Private Sub ComboBoxName_BeforeUpdate(Cancel As Integer)
      Me. MemoFieldTextBox = DLookup("MemoFieldName", "TableName", "[ UniqueIdentifier]= " & Me.ComboBoxName)
    End Sub


    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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