Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using tables over network
Message
From
26/11/1999 14:18:13
 
 
To
26/11/1999 11:43:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00295714
Message ID:
00295808
Views:
26
>I use a variable called autoincrement. When it equals true, I do this code in the add button
>
>if autoincrement = .T.
> select (tablename)
> private oldord
> M.OLDORD = ORDER()
> set order to &indexname desc
> go top
> store &fieldname to m.oldnum
> m.newnum = m.oldnum + 1
> SET ORDER TO &OLDORD
>endif
>
> APPEND BLANK
>
>
>if autoincrement = .T.
>* insert form.fieldname.value = m.newnum and set
>* form.fieldname.readonly = .T.
>
> &formfield = m.newnum
> &formfield2 = .T.
>endif
>
>the formfield is a hidden textbox on my form, that dipslays the new number and its control source is assignment.assignid which is the index in the table.
>
>The problem is when I click add on both machines the assignid = 14
>
>Thanks,
>Tyler

This strategy is wrought with problems in a multiuser scenario (as you have found). Look at the database in the TasTrade sample that ships with VFP to see an example of how to implement a multi-ser safe auti-id function.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform