Dear Mike:
With this code you can export your data form Excel to an Access Table:
********************************************************************
Sub ADOFromExcelToAccess()
' exports data from the active worksheet to a table in an Access database
' this procedure must be edited before use
Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As Long
' connect to the Access database
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=F:\BD\AFP.mdb;"
' open a recordset
Set rs = New ADODB.Recordset
rs.Open "OFICINASXDEPT", cn, adOpenKeyset, adLockOptimistic, adCmdTable
' all records in a table
r = 1 ' the start row in the worksheet
Do While Len(Range("A" & r).Formula) > 0
' repeat until first empty cell in column A
With rs
.AddNew ' create a new record
' add values to each field in the record
.Fields("IdPais") = Range("A" & r).Value
.Fields("IdAfp") = Range("B" & r).Value
.Fields("Year") = Range("C" & r).Value
.Fields("Month") = Range("D" & r).Value
.Fields("IdDept") = Range("E" & r).Value
.Fields("Cantidad") = Range("F" & r).Value
' add more fields if necessary...
.Update ' stores the new record
End With
r = r + 1 ' next row
Loop
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
********************************************************************
Thanks
Alfredo Mendiola Loyola
Lima PerĂº
www.geocities.com/peruscenery/
Mensaje citado por Mike :
> I have a .csv that will insert over 2500 rows into a table. How do I
> call the csv from access to insert the information into my database?
>
>
>
>
>
> Please zip all files prior to uploading to Files section.
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/AccessDevelopers/
>
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
>
TERRA NETWORKS PERU S.A. - Servicio de Correo.
Please zip all files prior to uploading to Files section.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AccessDevelopers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/