ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Duplicate Record.... (https://www.excelbanter.com/excel-programming/316351-duplicate-record.html)

sal21[_46_]

Duplicate Record....
 

Jamie Collins Wrote:
sal21 wrote ...

UHM... for me this is Arabic language


It's actually the SQL language.

Do you like to modify my script


Erm, OK then. The following is untested so ensure you have copies o
your files:

Sub ADO_PAGATI()
' exports data new rows from the active worksheet
' to a table in an Access database
Dim cn As ADODB.Connection

' connect to the Access database
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:\PROVA\PROVA.MDB;"

' Add new rows
Dim lngRowsAffected As Long
cn.Execute "INSERT INTO TOTALE" & _
" SELECT T1.[DATA CONT#], T1.DIP, T1.COD, T1.[C/C]," & _
"T1.NOMINATIVO, T1.[CAUS#], T1.[IMP# DARE]," & _
"T1.[IMP# AVERE], T1.[VAL#], T1.[SPORT# MITT#]," & _
"T1.[ANOM#], T1.[DESCRIZIONE OPERAZIONE]," & _
"T1.[INDICE (C#R#O#)], T1.ABI, T1.CAB," & _
"T1.[PAG#/IMP#], T1.[NR# ASS#], T1.MT, T1.SERVIZIO," & _
"T1.[NOTE B#O#U#], T1.SPESE, T1.[DATA ATTIVITA']," & _
"T1.COD1 FROM TOTALE AS T1 LEFT JOIN" & _
" [Excel 8.0;HDR=YES;Database=C:\MyWorkbook.xls;]" & _
".[L0785_TOTALE$A6:W65535]" & _
" AS T2 ON T1.SERVIZIO = T2.SERVIZIO" & _
" WHERE T2.SERVIZIO IS NULL", lngRowsAffected

cn.Close

MsgBox lngRowsAffected & " added to database."

End Sub


Jamie.

--

send me ths cript :confused: :eek: :(
i am "out of memory

--
sal2

-----------------------------------------------------------------------
sal21's Profile:
http://www.excelforum.com/member.php...nfo&userid=204
View this thread: http://www.excelforum.com/showthread.php?threadid=27654


Jamie Collins

Duplicate Record....
 
sal21 wrote ...

i am "out of memory"


Read through my list of assumptions. You may need to change the code
e.g. is your workbook is probably not saved as C:\MyWorkbook.xls.

I can't think of anyting in there that would cause 'out of memory',
though.

Jamie.

--


All times are GMT +1. The time now is 09:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com