I am trying to save each list box value (they are paths for attachments) to a table. I would also like to incorporate the code to copy these files to a new location. I have gotten this far, but am not sure how how to copy the files to a new location. The files are loaded to the list box via a file dialog box.
Code:
Dim i As Integer
For i = 0 To Me.ListBoxName.ListCount - 1
Me.lstAttach.List (i)
iAttachSQL = "INSERT INTO AttachmentFiles (File" & intAttachNo & ")" _
& "VALUES ('" & Me.lstAttch.List(i) & endSQL
CurrentDb.Execute iAttachSQL
Next i
My table has about 10 fields (File1, File2, etc). As it cycles through the items in the list box, I want to save them to each field, chaging the the field name (File?) incrementally. Pointers or ideas? I have never tried to use a field name containing a variable.
When I save the file to the new loaction, I would like to rename it to using a value from a textbox plus an incremental number. Am I trying to do too much? Help.