How can i know that my record is already on the table?
Example:
Seek idno(thisform.txtidno.value)
if found()
messagebox('Record already exist!')
thisform.refresh()
else
=tableupdate()
endif
is my example is good?
Actually i'm new in this programming i have my reference book here it is from QUE Books "Visual Foxpro 3.0 Expert Solutions" but seems to be i cannot catch what the book's says. So please help me to learned foxpro programming...
A many thanks!
Read the documentation on candidate index. See if that will solve your problem. [sig]<p>David W. Grewe<br><a href=mailtoave@internationalbid.net>Dave@internationalbid.net</a><br>[/sig]
select "Your Table"
set order to idno && you must have an index for this field
loca for idno=thisform.txtidno.value && if numeric you can a
&& val(thisform...)
&& if text,use alltrim
if found()
wait wind("Record already exist!" nowait
thisform.refresh()
else
procedures for table update...
endif
Also there is a nice tip in this month's FoxPro Advisor covering just this stuff. [sig]<p>John Durbin<br><a href=mailto: john@johndurbin.com> john@johndurbin.com</a><br><a href=
set order to idno && you must have an index for this field
loca for idno=thisform.txtidno.value && if numeric you can a
&& val(thisform...)
&& if text,use alltrim
FWIW, the Locate command does a search on the data without the index.
If you have an active index (as in your example above), use the Seek command to utilize the index.
FYI, Seek is significantly faster than locate. [sig]<p>Jon Hawkins<br><a href=mailto: jonscott8@yahoo.com> jonscott8@yahoo.com</a><br><a href= > </a><br>Focus on the solution....Not the problem.[/sig]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.