Source language: Translate to:

duplicate records who neoobook dbf

General questions about NeoBook

Moderator: Neosoft Support

duplicate records who neoobook dbf

Postby franco21 » Thu Apr 16, 2015 2:45 pm

Please and avoid entering duplicate records who neoobook dbf (not dbpro)

Any idea??
franco21
 
Posts: 122
Joined: Tue Jan 14, 2014 3:46 pm

Re: duplicate records who neoobook dbf

Postby Gaev » Thu Apr 16, 2015 3:18 pm

franco21:

Code: Select all
... say you have data to be added in variables like ...
SetVar "[myFirstName]" "John"
SetVar "[myLastName]" "Smith"
SetVar "[myCity]" "Toronto"
SetVar "[myCountry]" "Canada"
... and records are considered duplicate if fields FirstName and LastName are same
dbfQuery "Contacts.dbf" "FirstName=[myFirstName] AND LastName=[myLastName]"
dbfQueryCount "Contacts.dbf" "[Count]"
If "[Count]" "=" "0"
   dbfAddRecord "sample.dbf"
   ... populate the newly added record
   SetVar "[Contacts.FirstName]" "[myFirstName]"
   SetVar "[Contacts.LastName]" "[myLastName]"
   SetVar "[Contacts.City]" "[myCity]"
   SetVar "[Contacts.Country]" "[myCountry]"
   ... save the new record
   dbfCancelEdits "Contacts.dbf"
Else
   AlertBox "Oops" "You are attempting to add a Duplicate record"
EndIf

Note1: Variables [myFirstName] etc. can be associated with TextEntry boxes

Note2: above code can be part of a Button labelled "Add record"

Note3: during Edit, do NOT allow user to change content of fields that make up its unique characteristics (like FirstName and LastName in above example).
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: duplicate records who neoobook dbf

Postby franco21 » Thu Apr 16, 2015 3:30 pm

THANKS!!!!!!!!
franco21
 
Posts: 122
Joined: Tue Jan 14, 2014 3:46 pm


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 2 guests