Good Morning All,
I am not sure if I am posting this in the right place, but please bear
with me.
I am trying to run a db query to quickly populate a database with
filenames from a folder on my hard drive. Then in turn I would like to
be able to delete files from the folder, based on my deletes in the
database.
I hope that this makes sense. I am currently using the following code
in the Visual Basic editor to populate my table with the necessary
data:
Sub GetGameFiles()
Dim strFile As String
Dim strFolder As String
Dim strSQL As String
strFolder = "C:\path\to\thefile\iwantadded\tothisdb\"
strFile = Dir(strFolder & "*.*")
Do While Len(strFile) > 0
strSQL = "INSERT INTO gamenames (gamefilename) " & _
"VALUES (" & Chr$(34) & strFile & Chr$(34) & ")"
CurrentDb.Execute strSQL, dbFailOnError
strFile = Dir()
Loop
End Sub
I am currently running Access 2003. I also thought about trying this
with Excel 2003
If anyone can offer assistance it would be greatly appreciated.
Thank you.
Devon L.
Bookmarks