Duplicate Record....

  • Thread starter Thread starter sal21
  • Start date Start date
S

sal21

UHM... for me this is Arabic language....
Do you like to modify my script...
Tks
 
sal21 said:
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 of 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.

--
 

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

Back
Top