I had to remove the ".xls" on the file names to use this.
Access doesn't like period in table names. You might be
able to trim that off. I hope this can help
This creates the tables with the same name as in the
directory C:\testimport\ without the ".xls"
Private Sub Command0_Click()
Dim filename As String
filename = Dir("c:\testimport\*.*")
Do Until filename = ""
DoCmd.TransferSpreadsheet acImport, 8, filename,
"c:\testimport\" & filename, True, ""
filename = Dir
Loop
End Sub
>-----Original Message-----
>Can anyone tell me how to import multiple files into an
>Access 2000 db. I have over 100 files I need to import.
>Thanks.
>.
Jim/Chris - 10 Jun 2004 19:41 GMT
I got it now without renaming the files
Private Sub Command0_Click()
Dim filename As String
filename = Dir("c:\testimport\*.*")
Do Until filename = ""
DoCmd.TransferSpreadsheet acImport, 8, Left(filename,
InStr(filename, ".") - 1),"c:\testimport\" & filename, True, ""
filename = Dir
>Loop
>End Sub
I tested this and it works
Jim
>-----Original Message-----
>I had to remove the ".xls" on the file names to use this.
[quoted text clipped - 22 lines]
>>
>.
Miri - 10 Jun 2004 20:00 GMT
Thanks. This is exactly what I needed. What if I wanted
to import into the same table.
>-----Original Message-----
>I had to remove the ".xls" on the file names to use this.
[quoted text clipped - 22 lines]
>>
>.
Jim/Chris - 10 Jun 2004 20:13 GMT
This will import into the table named JIM. If it doesn't
exist the first import will create it. I hope this will help.
This creates the tables with the same name as in the
directory C:\testimport\ without the ".xls" without the xls
Private Sub Command0_Click()
Dim filename As String
filename = Dir("c:\testimport\*.*")
Do Until filename = ""
DoCmd.TransferSpreadsheet acImport, 8, "JIM",
"c:\testimport\" & filename, True, ""
filename = Dir
Loop
End Sub
Jim
>-----Original Message-----
>Thanks. This is exactly what I needed. What if I wanted
[quoted text clipped - 28 lines]
>>
>.
Miri - 10 Jun 2004 20:29 GMT
It worked perfectly. Thanks so much.
>-----Original Message-----
>This will import into the table named JIM. If it doesn't
[quoted text clipped - 50 lines]
>>
>.
Patrick - 13 Jun 2004 04:25 GMT
This is a function I would really like to use, however I can get it to work. Is this a module I would create? I know this is a beginner question so I may be in the wrong group.
Thanks for any help.
> It worked perfectly. Thanks so much.
>
[quoted text clipped - 58 lines]
> >>
> >.
Yes you would need to create a new module.
>-----Original Message-----
>This is a function I would really like to use, however I can get it to work. Is this a module I would create? I
know this is a beginner question so I may be in the wrong
group.
>Thanks for any help.
>
[quoted text clipped - 62 lines]
>>
>.