Kobojunkie
Kobojunkie

Reputation: 6535

MS Access Force Update on Combobox

How do I force an update when the ComboBox value is changed in code. Below is piece of code I have tried but does not seem to work

 If (Not Mid(sCode, 1, 2) = ddlLevelID1) Then
     ddlLevelID1 = Mid(sCode, 1, 2) 'force change/force AFTER_UPDATE event to run. 
 End If 

Upvotes: 0

Views: 2313

Answers (1)

enderland
enderland

Reputation: 14135

Assuming ddlLevelID1 is the ComboBox:

ddlLevelID1.value = foo

will change the value. I do not believe you can link a value displayed in a ComboBox to a variable value without pushing changes up to the userform after the value is changed.


Regarding the AfterUpdate method, from msdn:

Changing data in a control by using Visual Basic or a macro containing the SetValue action doesn't trigger these events for the control. However, if you then move to another record or save the record, the form's AfterUpdate event does occur.

http://msdn.microsoft.com/en-us/library/office/bb238392(v=office.12).aspx

Upvotes: 2

Related Questions