Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.
Dim cn As ADODB.Connection Dim strSQL As String Dim lngRecsAff As Long Set cn = New ADODB.Connection cn.Open _ "Provider = sqloledb;" & _ "Data Source=WSP0470.datasource.com;" & _ "Initial Catalog=QTS;" & _ "User ID=user;" & _ "Password=me;" For i = 2 To lastrow strSQL = "INSERT INTO .." cn.Execute strSQL, lngRecsAff, adExecuteNoRecords If lngRecsAff = 0 Then 'there was a problem and no record was added qtyRowsFailed = qtyRowsFailed + 1 Else 'all cool qtyRowsAddedToDatabase = qtyRowsAddedToDatabase + lngRecsAff End If Next i
Join the community of 500,000 technology professionals and ask your questions.