Question for Nikos (Add/update)

L

LJG

Hi Nikos,

You recently helped me sort an issue with regard to importing multiple
spreadsheets, and the suggestion you gave worked perfectly, however, since
doing this I have had a thought that some records might need to update
rather than a straight import, any tips on how I could code that to update
or append in that instance?

The code I have added is:
Sub Mass_Import()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSS As String
Set db = CurrentDb
Set rst = db.OpenRecordset("tblUsers") 'the name of the table
rst.MoveFirst
Do Until rst.EOF
strSS = "C:\database\dataimports\Prospects_" _
& rst.Fields("UserName") & ".xls" 'the name of the field
If Dir(strSS) <> "" Then
DoCmd.TransferSpreadsheet acImport, 8, "tblmamprospects", _
strSS, True, ""
End If
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub

Thanks again for your help

Les
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top