Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MultiUser Issue
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00540233
Message ID:
00540346
Views:
11
Leroy,

Why do you want to lock record before editing? Imagine, that user hits Edit button and goes to lunch. Other user would be unable to change this record. I believe, the common practice is to let users edit the same record, but in TableUpdate check for collisions. Last user will save and overwrite, changes by another user would be lost...

If it's not acceptable by your requirements, you should check here, because I believe, this problem was arised here before...


>I have form whose buffer mode is pessimistic and the cursor in the data environment is pessimistic row buffering
>(I would use OR buffering if I could get it to work).
>The form has a that has a button that I am using for an edit/save.
>As long as I am dealing with one user the code works fine, but
>I have been tring for days to figure out how I can handle the issues with multiusers clicking the edit/save button.
>
>Here is a sample of my edit/save code:
>
>		DO CASE
>			CASE ALLTRIM(UPPER(THIS.COMMAND8.CAPTION)) = 'EDIT'
>				** this will handle the command buttons
>				FOR START = 1 TO 9
>					THISBUTTON = 'THIS.COMMAND'+ALLTRIM(STR(START))+'.ENABLED'
>					IF START != 8
>						&THISBUTTON = .F.
>					ELSE
>						&THISBUTTON = .T.
>					ENDIF
>				ENDFOR
>				**** this is for the textboxes
>				FOR START = 2 TO 16
>					THISBOX = 'THISFORM.RFI_TEXTBOX'+ALLTRIM(STR(START))+'.READONLY'
>					&THISBOX = .F.
>				ENDFOR
>				**** this is for the editboxes
>				FOR START = 1 TO 3
>					THISBOX = 'THISFORM.RFI_EDITBOX'+ALLTRIM(STR(START))+'.READONLY'
>					&THISBOX = .F.
>				ENDFOR
>				THIS.COMMAND8.CAPTION = 'Save'
>			CASE ALLTRIM(UPPER(THIS.COMMAND8.CAPTION)) = 'SAVE'
>				lnResult = MESSAGEBOX('Are you sure you want to save',32+4,'Save Changes')				
>				IF lnResult = 6
>					DO SAVE_DATA WITH .T.
>
>				ELSE
>					DO REVERT_DATA WITH .F.
>				ENDIF
>                                *** change the textboxes back
>				FOR START = 2 TO 16
>					THISBOX = 'THISFORM.RFI_TEXTBOX'+ALLTRIM(STR(START))+'.READONLY'
>					&THISBOX = .T.
>				ENDFOR
>                                 ******* change the edit boxes back
>				FOR START = 1 TO 3
>					THISBOX = 'THISFORM.RFI_EDITBOX'+ALLTRIM(STR(START))+'.READONLY'
>					&THISBOX = .T.
>				ENDFOR
>				THIS.COMMAND8.CAPTION = 'Edit'
>				** this will handle the command buttons
>				FOR START = 1 TO 9
>					THISBUTTON = 'THIS.COMMAND'+ALLTRIM(STR(START))+'.ENABLED'
>					IF START != 8
>						&THISBUTTON = .T.
>					ELSE
>						&THISBUTTON = .T.
>					ENDIF
>				ENDFOR
>		ENDCASE
>
>Thanks in advance
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform