Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary Key
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00532997
Message ID:
00538289
Views:
12
>Can you send me the exact code you are using?
This is what is in the stored procedure:
**I am sending just the table name (paid_tob)
*** in the default value of the field (paid_id)
*** the call is GETKEY('paid_tob')

FUNCTION GetKey
LPARAMETERS tcTable

LOCAL lnArea, llOpened, liRetVal

* Save current work area
lnArea = SELECT()
llOpened = .F.

IF !USED("data\Keys")
  USE data\Keys IN 0 SHARED
  llOpened = .T.
ENDIF
SELECT Keys
SET ORDER TO TAG Table

* FLOCK seems to work a bit better than RLOCK.
* I've never had a problem with it.
DO WHILE !FLOCK()
ENDDO

SEEK UPPER(tcTable)
IF FOUND()
  liRetVal = NextId
  REPLACE NextId WITH NextId + 1
ELSE
  INSERT INTO Keys (Table, NextId) VALUES (tcTable, 2)
  liRetVal = 1
ENDIF

FLUSH
UNLOCK

IF llOpened
  USE IN Keys
ENDIF

SELECT (lnArea)
RETURN liRetVal
This part works fine in generating the key.
The problem comes in when I have a form that has a textbox that has a control source set to the paid_id of the paid_tob table.
I have an add button that has this code
select paid_tob
set order to paid_id
go bottom
APPEND BLANK
REPLACE ENTEREDBY WITH ALLTRIM(SYS(0)) +' '+ALLTRIM(GETENV('USER')) ;
	ENTERDATE WITH DATETIME()
THISFORM.REFRESH()
I think the problem could be in my add button. I have an add button but not a save button.
Should I also have a save button?
Like I said before, if only one session is going, it works find, however multiple instances gives me errors.
I am using optimistic Row Buffering.
Should I use Private data sessions or default data sessions on the forms?

Thanks so much for your help
What is Wisdom?
Wisdom - The ability to respond to any situation according to God's Plan.
Therefore:
USE Wisdom IN Everything ORDER priority AS Knowledge
SELECT Knowledge
BROWSE FOR Understanding WHERE Wisdom=Guide

LeRoy Jackson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform