PC Review


Reply
Thread Tools Rate Thread

Adding records to table

 
 
ReidarT
Guest
Posts: n/a
 
      27th Nov 2004
I use ADODB to add some records from one table to another. It seems that the
last record is missing in the updated table.

call LeggTilFirma()
....
Public Function LeggTilFirma()
Dim connStringCompany As String
Dim RsCompany As ADODB.Recordset
Dim sqlCompany As String

'***** åpne Connection ToFile
Dim cnnToFile As New ADODB.Connection
cnnToFile.CursorLocation = ADODB.CursorLocationEnum.adUseClient
connStringCompany = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=
xxxxx\Sales.mdb"
cnnToFile.Open(connStringCompany)

'*** Åpne recordset RsCompany
RsCompany = New ADODB.Recordset
sqlCompany = "INSERT INTO tblGrunndata ( Firmanavn, Adresse,
Telefon, Postnummer, " & _
"GrunndataCity, GrunndataCountry, Selgernavn ) " & _
"SELECT CompanyTillHEI2000H.CompanyName,
CompanyTillHEI2000H.Address, " & _
"CompanyTillHEI2000H.Phone,
CompanyTillHEI2000H.PostalCode, " & _
"CompanyTillHEI2000H.City, CompanyTillHEI2000H.Land, "
& _
"'Svensk selger' AS Selger " & _
"FROM CompanyTillHEI2000H LEFT JOIN tblGrunndata ON " &
_
"(CompanyTillHEI2000H.City =
tblGrunndata.GrunndataCity) AND " & _
"(CompanyTillHEI2000H.CompanyName =
tblGrunndata.Firmanavn) " & _
"WHERE (((tblGrunndata.Firmanavn) Is Null) AND
((tblGrunndata.GrunndataCity) Is Null))"

RsCompany.Open(sqlCompany, cnnToFile,
ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
Me.refresh()

cnnToFile.Close()

End Function

regards
reidarT


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding new records from one table to an existing table Josh Wexler Microsoft Access Queries 3 6th Jul 2007 04:28 PM
Adding records to one table, while working in a related table T Payne Microsoft Access Database Table Design 13 18th Aug 2006 02:27 AM
Create new table from existing table (adding records) Lex Microsoft Access 0 3rd Sep 2004 06:19 PM
Re: Adding records from another table when doing a make table query Rebecca Riordan Microsoft Access Queries 0 9th Jul 2004 05:19 PM
Adding Records to a table Howard Microsoft Access Form Coding 4 18th May 2004 08:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:15 AM.