|
-
Aug 7th, 2002, 04:35 AM
#1
[RESOLVED] Adding data to a table in Access
Hi There,
I'm just doing some work in Access and I can't for the life of me figure out how to add stuff to a table I have a collection of filenames 'mColFiles', I want to loop through the collection and add each filename to a table called 'Hyperlink_Ids_table', The name of the fields I wish to add them to is called 'Filenames'.
Excuse my stupidity but I have not worked with Access and can't figure out the answer from the help files.
Thanks
Maddy
-
Aug 7th, 2002, 05:09 AM
#2
Lively Member
hi, try if this code can help you.
Dim fs, f, f1, fc, strsql
Dim cn As New ADODB.Connection
cn.ConnectionString = "provider=microsoft.ket.oledb.4.0; data source=yourmdbpath.mdb"
cn.Open
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
For Each f1 In fc
strsql = "insert into Hyperlink_Ids_table (filenames) values ('" & f1.Name & "')"
cn.Execute (strsql)
Next
Your attitude determines your altitude!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|