ACCESS VBA table name as imported text file

mansied

Member
Local time
Today, 16:41
Joined
Oct 15, 2020
Messages
100
Hello, I have this code which imports a *.txt file into a table.how can I say change the table to the name of the text file not a fixed name?

Private Sub ImportData_Click()

ImportCompleted = Empty

Dim path As String
path = FilePathText.Value & ""
Dim tblName As String

tblName = "ZM"
If path = "" Then
MsgBox "You need to select a file to import!"
Else
Call Importing.import_ZM(path, tblName)
End If
ImportCompleted = "Import Completed!"

End Sub
 
Parse the Path variable with MID() and RevInstr() and remove the extension and pass that to your function. ?
Of course, the table will need to exist.
 
Hi. @Gasman probably meant to say InStrRev()...
 
Interesting...

I was not saying I was correct, just that I viewed the posts below and took that to be the correct syntax, which is now obviously incorrect.?

1605206493092.png
 

Users who are viewing this thread

Back
Top Bottom