I have a listbox, I want to get the value onclick and copy it to the control source of a listbox in microsoft access.
SearchResults is the name of the listbox
BookTitle is the name of the textbox
I have tried this code but it doesn’t seem to work:
Private Sub SearchResults_OnClick()
BookTitle.ControlSource = Forms!Edit!SearchResults.Column(2)
End Sub
Any help is much appreciated thankyou!
Why do you wish to copy to the control source? Is it the name of a field? If not, just set the value:
Do not forget that columns are numbered from zero.
Edit re comments
Very roughly.
Listbox:
A little code:
Add suitable control sources to any textboxes so you can edit the data in the underlying table. You can hide the textboxes if you wish.