AboutScottgem Expertise I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.
Experience I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.
Organizations Author of Microsoft Office Access 2007 VBA Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing
Question Could you help me with a combo box I have on a form. When I select the value in the combo box I want to automatically fill in unbound boxes in the form to give the details not in the combo box. I have done this before and for the life of me I cannot remember how to do it. e.g. if I select a value London from a combo box with two fields London and England, how can I put England automatically into another field. Any help greatly appreciated.
Answer There are a few ways to do this. If there are a lot of controls to populate, then I would use a subform linked to the combobox value.
If there are only 1 or 2 controls to populate then I would recommend using the columns property. What you do is expand the query behind the combobox to include columns for the other pieces of data you want to display. You can set the Column widths property so these columns don't show. Then use the After Update event to ppopulate the control. For example:
Me!Country = Me!cboCity.Column(2)
The columns start counting at 0 so Country would be the 3rd column (1st col is primary key, 2nd is city name). You can use the same code in the On Current event to populate the controls as you browse.
The alternative is using DLookups as the datasource of the unbound controls.
Hope this helps,
Scott<>
Please don't forget to provide feedback for this response (either by rating or followup). It helps me help people better if I know how my advice worked.