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!

File Dialog box

Status
Not open for further replies.

kaldag

MIS
Dec 2, 2002
24
0
0
US
I am using the file dialog box as described at and all works except storing the file location in the records. It shows up in the list box on the form. How do I collect that info in the database???

It will let me choose the location but when I go back to these record there is no listing of the files chosen.

Help

Ken
 
kaldag,
That code only populates the list box, if the list box is bound to a field in a table the data will only be stored after a selection in the list box is made.

If you want to store the list of selected files in a field you could do it in a delimited format (Row Source Type: Value List):
Code:
...
Dim strRowSource as String
...
      If .Show = True Then
         ' Loop through each file that is selected and then add it to the list box.
         For Each varFile In .SelectedItems
            Me.FileList.AddItem varFile
            strRowSource = strRowSource & Chr(34) & varFile & Chr(34) & ";"
         Next
      Else
         MsgBox "You clicked Cancel in the file dialog box."
      End If
...

Then when you navigate records you could use this string to populate a list box.

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
I made the change to the VB now how do I collect the choice?

Table??
 
kaldag,
I'm a little confused, are you trying to give your users the ability to select ONE file and store the path/name of the file.

Or, are you trying to allow your users to select MULTIPLE files and store the path/name of all the files choosen?

CMP

(GMT-07:00) Mountain Time (US & Canada)
 
The ability to select ONE file and store the path/name of the file.


Ken
 
kaldag,
Change the list box on your form to a text box, then set the control source of the text box to the field in your table. Then make the following changes to the routine:
Code:
...
AllowMultiSelect = False
...
      If .Show = True Then
        [s] ' Loop through each file that is selected and then add it to the list box.
         For Each varFile In .SelectedItems
            Me.FileList.AddItem varFile
            strRowSource = strRowSource & Chr(34) & varFile & Chr(34) & ";"
         Next[/s]
         Me.[[i]TextBoxOnForm[/i]] = .Item
      Else
         MsgBox "You clicked Cancel in the file dialog box."
      End If
...

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top