ComboBox Not Updating (1 Viewer)

4star

New member
Local time
Today, 05:13
Joined
Jul 19, 2019
Messages
11
I have a form in a Database that has a combobox on it with two fields. When an item is selected it shows the first column in the combobox and then shows the second column in a textbox next to the combobox for the user to see. A button then runs a query based on the selections in the combobox.

This all works fine, however, after the query is run and closed, if you then change the selected in the combobox the textbox doesn't update, we've tried putting the [Event Procedure] in AfterUpdate and other parts of the Event properties but it just doesn't seem to do anything.

Could anyone help, please?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:13
Joined
May 7, 2009
Messages
19,243
you should use the Combo's AfterUpdate:

private sub combo_afterupdate()
me![textboxname] = null
if me!combo.listindex > -1 then
me![textboxname] = me!combo.column(1)
end if
end sub
 

4star

New member
Local time
Today, 05:13
Joined
Jul 19, 2019
Messages
11
That's worked brilliantly, thank you!
 

4star

New member
Local time
Today, 05:13
Joined
Jul 19, 2019
Messages
11
For some reason, what once worked, now we can't get it to run, on changing the data in the combobox Access now throws out "Run time error 2448 - You can't assign a value to this object."
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:13
Joined
May 7, 2009
Messages
19,243
go to the form in Design View, and click on the Textbox.
on its property->Control Source, remove everything (i suppose you have and Expression in there
like "=combo.column(1)").
 

Isaac

Lifelong Learner
Local time
Yesterday, 21:13
Joined
Mar 14, 2017
Messages
8,777
Access now throws out "Run time error 2448 - You can't assign a value to this object."
What is the textbox's name, and what is your current combobox code?
 

Users who are viewing this thread

Top Bottom