Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Appending records from an import file.

Status
Not open for further replies.

pitbull

IS-IT--Management
Jun 21, 2001
12
GB
Currently using the following to add records from my import file:
Open MyfileName For Append As MyFil

While Not EOF(MyFil)
Line Input #MyFil, MyLine
Select Case UCase(Left(MyLine, 2))

Case Is = "00" 'Header Line DONE x

Dim MyDb As Database
Dim MyRecordset As Recordset

Set MyDb = CurrentDb 'set MyDb to current database - OBJECT
'then can utilise the .

Set MyRecordset = MyDb.OpenRecordset("Header Record") 'recordset to work with
'MyRecordset.AddNew
'Add new record to the recordset
MyRecordset![Dummy-00] = Mid(MyLine, 3, 8) 'set the ContactType field to Staff
MyRecordset![Logical-Date] = Mid(MyLine, 11, 10)
MyRecordset![Last-Suc-Run-Date] = Mid(MyLine, 21, 31)
MyRecordset.Update 'to save the changes, addition(s)


However I need to append the records just in case the record has been updated in a future import file as we will received updates of records.

Any ideas please.


 
Why not append all records to a temp table. Then you could run two queries, one to add it if it is not found and the other to update it if it is. Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top