By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,663 Members | 762 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,663 IT Pros & Developers. It's quick & easy.

User defined drive location for docmd.TransferText

P: 9
Hi there, can anyone tell me how to allow the user to enter in a path on there harddrive for a transfertext item? It works just fine if I set it programmatically, but I really need them to do this, because the location may change.
This is in Access 2000, btw.

Thanks, proteusgak
May 17 '07 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,628
Hi there, can anyone tell me how to allow the user to enter in a path on there harddrive for a transfertext item? It works just fine if I set it programmatically, but I really need them to do this, because the location may change.
This is in Access 2000, btw.

Thanks, proteusgak
Expand|Select|Wrap|Line Numbers
  1. 'First, you must set a Reference to the Microsoft Office XX.X Object Library
  2. Dim varItem As Variant, strSelectedFile As String
  3.  
  4. With Application.FileDialog(msoFileDialogFilePicker)
  5.    With .Filters    'only 1 Filter needed
  6.      .Clear
  7.      .Add "Text Files", "*.txt"
  8.    End With
  9.        'The Show Method returns True if 1 or more files are selected
  10.        .AllowMultiSelect = False
  11.        .ButtonName = "Find Text File"
  12.        .InitialFileName = vbNullString
  13.        .InitialView = msoFileDialogViewDetails
  14.        .Title = "Select Ttext File to Transfer"
  15.               If .Show Then
  16.                    For Each varItem In .SelectedItems
  17.                      strSelectedFile = varItem     'will only be 1
  18.                    Next varItem
  19.               End If
  20. End With
  21.  
  22. 'Sample example
  23. DoCmd.TransferText acImportDelim, , "<Table Name>", strSelectedFile, "<True or False>"
May 17 '07 #2

P: 9
First, Thank you!

For those that might look at this thread, my intent was to "export" a file that the user could manipulate in a bound table field. Thanks to aDezii
the following simple code was gleened.
Expand|Select|Wrap|Line Numbers
  1. Dim varItem As Variant, strSelectedFile As String
  2.         strSelectedFile = BillingDriveLocation 'bound table field allowing for user to input variable drive locations
  3.     DoCmd.TransferText acExportFixed, "As400MLV618", "as400", strSelectedFile
It works great!

Again, thank you.
ProteusGak
May 17 '07 #3

ADezii
Expert 5K+
P: 8,628
First, Thank you!

For those that might look at this thread, my intent was to "export" a file that the user could manipulate in a bound table field. Thanks to aDezii
the following simple code was gleened.
Expand|Select|Wrap|Line Numbers
  1. Dim varItem As Variant, strSelectedFile As String
  2.         strSelectedFile = BillingDriveLocation 'bound table field allowing for user to input variable drive locations
  3.     DoCmd.TransferText acExportFixed, "As400MLV618", "as400", strSelectedFile
It works great!

Again, thank you.
ProteusGak
Sorry for the mix-up.
May 17 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.