List box Click through (1 Viewer)

Jaydub1991

New member
Local time
Today, 13:10
Joined
Sep 21, 2021
Messages
7
Would anyone be able to help me with code for a list box click through code for VBA

I have a search form which i have set up which pulls data from a table but I also have a form set up which displays each individual data row.

I would like to be able to search in my form, click the result and get taken to the correct form field

So I have tried to look for others that have done this but im not good at VBA so may need bottle feeding on this!

so far i have seen stuff like
'listbox.selecteditem.tostring'

but i havent got a clue how to make it go to the correct record on the form
 

Ranman256

Well-known member
Local time
Today, 09:10
Joined
Apr 9, 2015
Messages
4,339
Do want to click the item in the list, then show that record (filter)

Code:
sub lstBox_Afterupate()
if IsNull(lstBox) then
   me.filterOn = false
else
  me.filter = "[ID]=" & lstBox
  me.filterOn = true
endif
lstBox.requery
end sub
 

Gigitty

Member
Local time
Today, 06:10
Joined
Mar 29, 2007
Messages
52
Would anyone be able to help me with code for a list box click through code for VBA

I have a search form which i have set up which pulls data from a table but I also have a form set up which displays each individual data row.

I would like to be able to search in my form, click the result and get taken to the correct form field

So I have tried to look for others that have done this but im not good at VBA so may need bottle feeding on this!

so far i have seen stuff like
'listbox.selecteditem.tostring'

but i havent got a clue how to make it go to the correct record on the form
Can't you just use a 'Combo Box' wizard? Much easier and no VBA required.
 

Users who are viewing this thread

Top Bottom