Results 1 to 2 of 2

Thread: [RESOLVED] Adding data to a table in Access

  1. #1
    Madeline
    Guest

    Resolved [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

  2. #2
    Lively Member
    Join Date
    Jun 2002
    Location
    Kuwait
    Posts
    85
    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
  •  



Click Here to Expand Forum to Full Width