07-05-13, 18:40 #1Registered User
- Join Date
- Jul 2013
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!
07-05-13, 20:39 #2Moderator
Provided Answers: 19
- Join Date
- Jun 2005
- Richmond, Virginia USA
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
- UniqueIdentifier is the name of the Field in the Table
' If the UniqueIdentifier is Text
Private Sub ComboBoxName_BeforeUpdate(Cancel As Integer) Me. MemoFieldTextBox = DLookup("MemoFieldName", "TableName", "[UniqueIdentifier]= '" & Me.ComboBoxName & "'") End Sub
' If the UniqueIdentifier is Numeric
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