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.
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.