Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate records?

Status
Not open for further replies.

august

MIS
Aug 24, 2000
150
PH
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?

i'm new in programming.

August

[sig][/sig]
 
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!

August [sig][/sig]
 
you can use this sql command option in checking duplicate records.....

SELECT *;
FROM urTable ;
GROUP BY urFieldtocheck ;
HAVING COUNT(*)>1

regards,
edencios

[sig]<p>dencios<br><a href=mailto:edencios@hotmail.com>edencios@hotmail.com</a><br>System Developer[/sig]
 
Read the documentation on candidate index. See if that will solve your problem. [sig]<p>David W. Grewe<br><a href=mailto:Dave@internationalbid.net>Dave@internationalbid.net</a><br>[/sig]
 
Your example is good.

You can also try this:

select &quot;Your Table&quot;
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(&quot;Record already exist!&quot;) nowait
thisform.refresh()
else
procedures for table update...
endif

Hope this helps..

Wendz
edbb@lycos.com [sig][/sig]
 
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= </a><br>MCP Visual FoxPro<br>
<br>
ICQ #9466492<br>
ICQ VFP ActiveList #73897253[/sig]
 
Hi Wendz,

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]
 
Thanks guys! for the response!!!

August [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top