Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
'Save' as 'Revert'
Message
From
14/03/2001 23:03:46
 
 
To
14/03/2001 17:01:45
Chuck Tripi
University of Wisconsin - Milwaukee
Milwaukee, Wisconsin, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00485071
Message ID:
00485170
Views:
15
Pay attention to what Cindy says about INDEXSEEK. The record pointer is not moved so the person.id = m.id will not work reliably....however, if you're using row buffering I can see a problem.

Also, if you're using memvars (yuck, but whatever floats your boat), you can always use SCATTER MEMVAR.


>IF INDEXSEEK(m.id)
> IF person.id = m.id AND ;
> person.name = m.name AND ;
> person.logon = m.logon
> wait window 'Same stuff'
> ELSE
> Messagebox('This Person ID is already in the database.'+CHR(13)+ ;
> 'Duplicate Records will not be saved!',64)
> m.id = person.id
> m.name = person.name
> m.logon = person.logon
> ENDIF
>ELSE
>
>then the rest of the code does it's thing (as 'Add' or 'Edit') and refreshes...
>
>My question is since this above code works (in 'Save' ClickEvent), I feel there is a better way to do this. What is happening is if the user click the 'Edit' button, the only two buttons become enabled ('Save' and 'Esc', 'Esc' works like 'Revert' but they want to call it like that). Now, if the user click 'Esc', it goes back just the way it was before (disables and enables all other stuff). If the user click 'Save', but didn't change anything, I want to just go back just like 'Esc' does. The code above is where this catches this part, so there is nothing updating the tables yet, the updating occurs just right after this ELSE. I am using memory variable, so what does VFP 6.0 have for that, or that's it? I know it's little weird, but we know that's part of programming life.
>
>Chuck
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Reply
Map
View

Click here to load this message in the networking platform