Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference a value from a listbox using Access VBA

Status
Not open for further replies.

dssjon

MIS
May 29, 2007
37
US
I am trying to reference a value from a listbox as a string so that I can use that as a filename in a sub. I need to unzip all the file names that I have in a table, I am using that tables rowsource data in a listbox and from the listbox I want to copy the filename and use it in an unzip sub. Any ideas?

My code is:


fnameString = Me.List0.Value
fname = CurrentProject.Path & "\" & fnameString

'CurrentProject.Path & "\Files.zip" works but I need to replace the static filename with the referenced name from the listbox. Any help would be appreciated.
 
If the bound column of the listbox is not the filename one then you may use the Column property.
Furthermore, if the listbox is multiselect then you have to play with ItemsSelect collection.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top