• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 370
  • Last Modified:

bound combobox value doesn't change

I have a combobox cboBackEnd that is bound to BackEndID in tblKeepingTrack.
When a user clicks on btnChangeBackEnd in code I have the following in code:
Me.cboBackEnd = IIf(Me.cboBackEnd(2) = "Local", 3, 2)
(In my tblBackEnds, 3 is the ID for the Server BackEnd and 2 is the ID for the Local Backend)

When I click the button, I see the value of the combobox change on the form, but when I exit and return to the form, the old value still shows up in the combobox. When I change the combo by hand, however, then the value is saved. How can I save the value when the user clicks the button?
1 Solution
You don't need the button.  Base the combo on:
Values 2;"Local";3;"Server"
Bound Column 1
Number of Columns 2
Column Widths 0";0.6"

BTW something is wrong in the logic of your question.  The IIF() statement looks like it will set the combo to 3 if the second column is Local, yet the next line says 2 is Local.  Anyway, throw the button away and enter these values in the properties.  Now you will see just Local and Server in the dropdown, and when you select either, the combobox value will have the appropriate number, 2 for Local and 3 for Server.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now