Connecting Tech Pros Worldwide Help | Site Map

Copying new records

John
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi

I need to copy new records from an access table which can potentially have
records added to it all the time by users. I figure I can add a flag for
records that have been copied already that can be set after copy. The
problem is that in the time that I copy all new records using 'select * from
... where not flag' and coming back to update flags for all records not
already flagged, new records could have been entered by the users which may
also get flagged as copied with 'update ... set flag=true where not flag'.
How can I differentiate between the records that are copied and still not
flagged and the records that are new and have not been copied.

Thanks

Regards


Allen Browne
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Copying new records


You should be able to BeginTrans, then copy your records and set the flag
before CommitTrans.

You may find that this approach blocks other records from being added during
your copy operation, but it should avoid the problem where new records are
added and wrongly flagged.

If you want an example of how to work with transactions, see:
http://allenbrowne.com/ser-37.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"John" <john@nospam.infovis.co.uk> wrote in message
news:40dc3eec$0$275$cc9e4d1f@news-text.dial.pipex.com...[color=blue]
>
> I need to copy new records from an access table which can potentially have
> records added to it all the time by users. I figure I can add a flag for
> records that have been copied already that can be set after copy. The
> problem is that in the time that I copy all new records using 'select *[/color]
from[color=blue]
> .. where not flag' and coming back to update flags for all records not
> already flagged, new records could have been entered by the users which[/color]
may[color=blue]
> also get flagged as copied with 'update ... set flag=true where not flag'.
> How can I differentiate between the records that are copied and still not
> flagged and the records that are new and have not been copied.[/color]


Closed Thread