Hi guys, noob to this forum and I have limited Access experience, although this is changing rapidly 
In brief, I have a form which appears on loadup which holds a combobox and some textboxes. The combobox is populated with 6 fields from a table, with 5 of the fields set to 0cm in width in the properties. Once an item is selected, the other columns are used to populate textboxes in the form using vba. However, when I select a value from the combobox, the textboxes are populated correctly but the combobox resets back to item one.
In more detail...
I have a form with a combobox called combo_equipment_ID which is populated with the following SQL code to retrieve values from 6 fields within a table called Equipment Information.
Code:
SELECT Equipment_Information.Equipment_Code, Equipment_Information.Equipment_ID, Equipment_Information.Location, Equipment_Information.Hospital, Equipment_Information.Manufacturer, Equipment_Information.ModelFROM Equipment_Information
ORDER BY Equipment_Information.Equipment_ID;
The combobox has the columns sized such that 5 of the fields are 0cm in width, with only the 2nd column (the equipment ID) visible at 5cm in width.
I have some VBA code to run after a selection is made on the combobox to set the values in the other columns as the values of some textboxes on the form, as shown below. For information, the Form_Load is just some commands to reset the form, but shouldn't actually run when a selection is made.
Code:
Private Sub combo_equipment_ID_afterupdate()'sub to run after the equipment ID combobox has been updated and an item selected
'if the combobox is empty, reset the buttons, otherwise set the details from the database
If IsNull(combo_Equipment_ID) Then
'all the code needed to reset the form is in the load code
Call Form_Load
Else
'after selection from the dropdown menu, set the captions so that the user knows which equipment they have selected
Me.textbox_equipment_man = CStr(Nz([Forms]![Welcome]![combo_Equipment_ID].Column(4)))
Me.textbox_equipment_model = CStr(Nz([Forms]![Welcome]![combo_Equipment_ID].Column(5)))
Me.textbox_department = CStr(Nz([Forms]![Welcome]![combo_Equipment_ID].Column(2)))
Me.textbox_hospital = CStr(Nz([Forms]![Welcome]![combo_Equipment_ID].Column(3)))
'reenable buttons
Me.button_Add_Survey.Enabled = True
Me.button_Edit_Equipment.Enabled = True
Me.button_View_Results.Enabled = True
Me.button_Add_Equipment.Enabled = False
End If
End Sub
Everything works fine, with the correct fields appearing in the combobox and the textboxes populated correctly. However, once a selection is made, the combobox resets and shows the first value in the list. This isn't only confusing for the person using the form, it is also a problem when that combobox value is referenced by another.
Does anyone have any ideas on what might be happening or where to start looking for a solution? I have been through the properties of the combobox and I can't find anything which suggests a possible solution.
Thanks in advance