RE: Driving Text Box display from Combo Box Selection

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Howard Brody (anonymous_at_discussions.microsoft.com)
Date: 05/21/04


Date: Fri, 21 May 2004 09:01:07 -0700

Use DLookUp functions (check the Help files for details) in the AfterUpdate event for the ComboBox. This should let you pull the data you want for the selected material spec and display it in the TextBoxes.

Try something like this (for pulling and populating the material name):

' declare variables
Dim strMSpec As String
Dim strMName As String

strMSpec = [cboMaterialSpec]
strMName = DLookUp("[matName]","tblMaterialsTable","[matSpec]='" & strMSPec & "'")

[txtMaterialName] = strMName

Hope this helps!

Howard Brody

     
     ----- Jon wrote: -----
     
     I am working from 2 tables - 'Items' and 'Materials'. The 'Items' table includes thing like 'Item Width' and 'Item Length'. The 'Materials' Table includes things like 'Material Spec Number', 'Material Name', 'Material Gauge'. I am working on a Form to allow the user to input information about 'Items' (one being the 'Material Spec'). I have created a combo box that allow the user to choose the appropriate spec from a list.
     
     Based on this choice, I want to populate separate Text Boxes with addtional information about the material - such as Material Name, Material Gauge etc.
     
     Obviously, I'm new to Access. Can you offer some education? Thanks