Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2008

Tip: Looking for answers? Try searching our database.

Fill choices in combo box from a directory of documents

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
magicdds - 25 May 2008 20:09 GMT
I have the following code:

Private Sub Command0_Click()

Dim strDirPath  As String
Dim strOutDocName As String
Dim strDir          As String
Dim strDirEntry     As String

' strDirPath is a Function that Gets the path to the Microsoft Word Directory

strDirPath = DirToPath("word\", False)
strDir = strDirPath & "*.doc"

strDirEntry = Dir(strDir)

Do While strDirEntry <> ""
      MsgBox strDirEntry
      strDirEntry = Dir
Loop

End Sub

When I click on a button in my form , the code above runs and message boxes
pop up printing out each document in the Word directory. I would like to
populate the choices in a combo box on the form with each of these documents,
so I can click on the document thayt I want to print.

How can I populate the combo box with the list of documents instead of
displaying them with the Msgbox command?

Thanks
Mark
Damon Heron - 25 May 2008 20:31 GMT
check out help for combobox.additems....
Here is a function to add items to a combobox set to value list:

Function AddItemToBeginning(ctrlComboBox As ComboBox, _
       ByVal strItem As String)

   ctrlComboBox.AddItem Item:=strItem, Index:=0

End FunctionDamon

>I have the following code:
>
[quoted text clipped - 32 lines]
> Thanks
> Mark
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.