Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NewID() working randomly
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00254709
Message ID:
00254761
Views:
33
>I'm using a NewID() function to lookup "NextKey" values for adding records to my database. This function suites my needs perfectly when it works, but for some reason, it doesn't always work. I haven't pinned down what changes occur in my project that disable this function, but they're NOT changes in the DB, as that has been unchanging.
>
>* Excerpt from function NewID()
>*=================================
>IF ! USED("rv_nextkey")
> USE "eis!rv_nextkey" IN 0
>ELSE
> REQUERY("rv_nextkey")
>ENDIF
>
>IF _TALLY = 1
> MESSAGEBOX("_Tally was successfull")
> SELECT rv_nextkey
> llSuccess = .F.
> DO WHILE ! llSuccess
> lnRetVal = rv_nextkey.nextkey
> REPLACE rv_nextkey.nextkey WITH rv_nextkey.nextkey + 1
>*etc..
>*=================================
>
>I've been stepping through the above code and for some reason the USE "eis!rv_nextkey" IN 0 isn't returning _TALLY = 1
>
>The entry for _TALLY in Hacker's Guide doesn't list USE as being a command that changes _TALLY, but, as I said, this code does work sometimes. (The code actually came from another FVP book, so somebody else thought it should work as well).
>
>Browsing the NextKey table with the correct parameters gives the expected results, I just can't figure out why this function is inconsistent.
>
>Any suggestions?

Is rv_nextkey a view? why not REQUERY() whether or not it was already open?
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform