BamaColtsFan
Registered User.
- Local time
- Today, 03:16
- Joined
- Nov 8, 2006
- Messages
- 91
Team,
I'm trying to use the TransferText function I found listed here by several users. I have set up my own version and it woirks very nicely except that I now need to call a stored value to get the file path for the function. My first example shows the function in it's working form based on what I found here:
Now, I'd like to be able to select the path value from a stored table in my DB. The value in this example would be "C:\Files\" and is stored in the table Set_Path. As posted below I get "Compile Error: Type mismatch." If I wrap newPath in quotes I get an error that says Access can't find the object.
So, my question is what am I doing wrong in the second example? Any advice would be appreciated!
THNX
I'm trying to use the TransferText function I found listed here by several users. I have set up my own version and it woirks very nicely except that I now need to call a stored value to get the file path for the function. My first example shows the function in it's working form based on what I found here:
Code:
Sub transferHardPath()
Dim path As String
path = "C:\Files\Test_Data_One.txt"
DoCmd.TransferText acImportDelim, "MyImportSpec", "MyTableTestOne", path
End Sub
Now, I'd like to be able to select the path value from a stored table in my DB. The value in this example would be "C:\Files\" and is stored in the table Set_Path. As posted below I get "Compile Error: Type mismatch." If I wrap newPath in quotes I get an error that says Access can't find the object.
Code:
Sub transferSoftPath()
Dim db As DAO.Database
Dim newPath As DAO.Recordset
Set db = CurrentDb()
Set newPath = db.OpenRecordset("Set_Path")
DoCmd.TransferText acImportDelim, "MyImportSpec", "MyTableTestTwo", newPath & "Test_Data_Two.txt"
End Sub
So, my question is what am I doing wrong in the second example? Any advice would be appreciated!
THNX