I've run into this myself. Locking the file AFTER setting the Record ID worked
for me, however, I was using a File object, not a Dictionary object. I believe
the mechanism is the same in either case.

Try:
  gcolFiles(pstrFileName).RecordID = "LAST.ID"
  gcolFiles(pstrFileName).Lock
  10: gcolFiles(pstrFileName).Read


Martin Scholl wrote:

> I use a LAST.ID item in the file dictionary to manage ID creation.  The lock
> that I place on this record while I increase the ID does not work.
>
> gcolFiles(pstrFileName).RecordID = "LAST.ID"
> 10: gcolFiles(pstrFileName).Read
>     If gcolFiles(pstrFileName).Error = UVE_NOERROR Then
>         gcolFiles(pstrFileName).LockRecord EXCLUSIVE_UPDATE
>         bla-bla
>     ElseIf gcolFiles(pstrFileName).Error = UVE_RNF Then
>         Set pitemLastID = New UniDynArray
>         bla-bla
>     ElseIf gcolFiles(pstrFileName).Error = UVE_LCK Then
>             Sleep 5
>             GoTo 10
>     End If
>
> If I have multiple instances of my executable running, the lock does not
> work and I end up with overwriting records which is real bad. Do read locks
> not work with dictionries? Or does anybody have another suggestion?
> Martin Scholl
> President HIPAAsuite
> 18910 New Hampshire Ave
> Brinklow, MD 20862
> 301-924-5537  Phone
> 301-570-0139  Fax
> 301-613-9572  Cell
> -------
> u2-users mailing list
> [EMAIL PROTECTED]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to