Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to handle the duplicate value in grid
Message
From
06/09/2001 06:06:45
 
 
To
06/09/2001 05:46:43
Henry Sudarma
Jakarta Institute of Technology
Jakarta, Indonesia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00553015
Message ID:
00553017
Views:
11
Hi!

What is wrong with this approach? It should work, I guess.

After you used locate, use 'Go (nNumber)' to return record back to the record number edited in grid. LOCATE will stay at eof() when duplicated value not found, so the resto of this code will probably look like following:
...
locate for cstuff = f_stuff and nNumber <> recno() and m_stuff1.f_code = m_stuff2.f_Code
if !eof() && duplicate found
  = messagebox("The item with such code already exists! Please enter another code.")
endif
Go (nNumber)
Just a note:
In good interface unique values are not shown to user or application suggests unique value to user automatically from available range of unused values.



>hi,
>i have problem with my grid. I am developing an application.
>That application have one grid, and the value in grid must not has duplicate value.
>For example, one transaction have one transaction number, and have many stuff. And that stuff must not has duplicate value.
>Please give me some example. Because i've try to use this code :
>
>select m_stuff
>nNumber = recno()
>cStuff = f_stuff
>locate for cstuff = f_stuff and nNumber <> recno() and m_stuff1.f_code = m_stuff2.f_Code
>
>And i use, table buffer with pesimistic locking at table in both table(m_stuff1 and m_stuff2)
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform