Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking if item already exists
Message
From
18/10/2007 15:30:20
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01261920
Message ID:
01261929
Views:
9
Missing informations. Is the textbox bounded to the field Banco in the cursor Bancos1 or Bancos? Is this a multi-user application? If so, your logic would not work in the case that 2 users enter the same value at the same time. Can you make the field a candidate key in the table instead? Or use a trigger?

>I need to know if an item is in a table before updating the table
>
>From the table bancos.dbf I have two cursors as below, buffered
>pessismist (4)
>
>
>SELECT BANCOS1
> BROWSE
>
>SELECT BANCOS
> BROWSE
>
> LOCATE FOR (UPPER(BANCO) = UPPER(THISFORM.TEXT1.Value)
>
>IF FOUND ()
> = MESSAGEBOX ("The record already exists")
> RETU
> endif
>
>= MESSAGEBOX ("uptade")
> SELECT bancos1
> TABLEUPDATE()
> THISFORM.Release
>
>At the first time it works fine, because as in browse test
>the new item only appear in bancos1 and not in bancos
>
>
>The problem is that if the item already exists,
>then it always will repeat "item already exists" even
>if I type a completely differente item
>
>It looks like it accour an inversion, because the item
>is not shown in bancos1 but is shown in bancos
>
>So, I have the false menssage that the item already exist
>
>Moises
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform