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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2002 & VBA. Please help

Status
Not open for further replies.

thelke

MIS
Apr 9, 2002
84
This code requires a button, a list box, and a reference to Microsoft Office 10.0 Object Library. The button event OnClick is this code:

Private Sub cmdPlansPathButton_Click()

Dim fDialog As Office.FileDialog
Dim varFile As Variant

Me.PlansPath.RowSource = ""

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.AllowMultiSelect = False

.Title = "Please select a Folder"

If .Show = True Then
For Each varFile In .SelectedItems
Me.PlansPath.AddItem varFile
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub

I want this to go into a varchar field, but in order for the Listbox fieled to be recognized by the database(entered into the varchar field), I have to click on the field (did that make sense?). I need a way to make the data exist (the folder path) in code, so a user can browse for the path, hit OK in the browse window, and have the path appear in the table.

Thank you in advance for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top