Hi. I have written a process that takes a list of values from a spreadsheet and updates a foxpro table, adding records if they do not exist, or updating them if they do.
I determine if the record exists by a seek command, which works fine. But if my process has previously added a record, it appears that the seek command fails to find the next item even if it does exist.
What am I doing wriong here? - Code is as follows.
Set RsMasterFile = dbsCompany.OpenRecordset(strMasterFile)
RsMasterFile.Index = "ACCOUNTIDX"
'Loop with each strAccountNo - Code not shown for brevity
RsMasterFile.Seek "=", strAccountNo
If RsMasterFile.NoMatch Then
'We have a new Account - Create it
RsMasterFile("UniqueId") = strUniqueId
'Update the existing record
'End of Loop
If I have an existing Item and then a New Item - this code works, updating the existing item and adding the new one.
But if I have a New Item and then an Existing Item - the code does not work, it adds both items as though they are both new items
I presume that the first addnew affects the index or seek somehow, so that the second item is not found even though it exists, but I cannot find anything that warns about this, or gives a work around.
Does anyone know what is happening here and how to fix?