lakers8176
IS-IT--Management
I have a variable defined in my vb code and I would like to pass that variable to a text box on a form. I'm not sure how to go about doing that. Here is the code that I am currently using. I would like to pass the varFile.
Code:
Function PickFile()
Dim fDialog As Office.FileDialog
Dim varFile As Variant
'Set up the File Dialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = False
.Title = "Select a Text File to Import"
.InitialFileName = "\\cvsftp001\ftproot\mis\bis111a\bis111a*.txt"
'Clear out any Filters, then Add you own (1)
.Filters.Add "Text Files", "*.TXT"
'Show the Dialog. If the Show Method returns True, the User picked
'at least 1 File, otherwise the User clicked Cancel
If .Show Then
For Each varFile In .SelectedItems
'There will be only 1 File selected, so place the proper Arguments into the TransferText Method
DoCmd.TransferText acImportFixed, "Bis111a", "Bis111a", varFile
Next
Else 'Nothing selected in File Dialog
End If
End With
End Function