SamDeMan-
Thanx for some of the links. Started to work with some code that MAY help in the interim, until I can find something closer to what I want to accomplish. I do need some help translating/understanding some of the following code:
Dim startRow As Integer
Dim totalRows As Integer
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim r As Long
Dim i As Integer
Dim strTargetCC As String
startRow = Selection.Row
totalRows = Selection.Rows.Count
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=C:\CAS\cost_accounting.mdb;"
' open a recordset
Set rs = New ADODB.Recordset
rs.Open "DIST_KEYS", cn, adOpenKeyset, adLockOptimistic, adCmdTable
r = startRow
i = 1
Do While i <= totalRows
If CcTargetCon = True Then
strTargetCC = Left(Range(CcTargetColumn & r).Value, 6)
Else
strTargetCC = Range(CcTargetColumn & r).Value
End If
With rs
.AddNew ' create a new record
' add values to each field in the record
.Fields("CC_ORIGIN") = CcOrigin
.Fields("REK_NR") = RekNr
.Fields("CC_TARGET") = strTargetCC
.Fields("PERCENT") = Range(PercentColumn & r).Value
.Fields("Not_Like") = NotLikeInd
.Update ' stores the new record
End With
i = i + 1
r = r + 1 ' next row
Loop
rs.Close
cn.Close
Specifically, I'm trying to interpret the area in blue. Does the .Fields("CC_ORIGIN")=CcOrigin refer to the field name in excel to be tranferred into the field name in access, or the other way around?