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!

FindFirst method fails to detect existing record

Status
Not open for further replies.

delorfra

Programmer
Mar 8, 2001
79
FR
Hi,

I have a loop extracting data from a textfile to update a linked table in Access (from Oracle).
I open the linked table with
set myset=mydb.Openrecordset(mytable,2,dbseechanges)
then
do
'read new line in then text file and define myitem from it
myset.findfirst "itemNo='" & myitem & "'"
if myset.NoMatch then
'add new record
else
'edit record
end if
loop ...

The problem is that the findfirst/nomatch method fails to find records that have just been added in the previous iterations of this routine, meaning that it tries to add duplicates contained in the text file instead of going for the edit mode (as if the recordset were not constantly updated).
I have added the option dbseechanges to no avail.

Thanks for your help

François


blygman@hotmail.com

François
 

do

'read new line in then text file and define myitem from it
myset.findfirst "itemNo='" & myitem & "'"
if myset.NoMatch then
'add new record
else
'edit record
end if
====> myset.movelast
loop ...

 
Oops !

I had already tried adding .movelast but I have just realized that I have left it outside of the loop so it had no effect.

Thanks anyway for your help VBAJOCK


blygman@hotmail.com

François
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top