Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to exclude duplicates
Message
From
09/04/1998 13:28:56
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00090768
Message ID:
00090854
Views:
17
>>>I want to check for duplicates before I commit a new record.
>>>
>>>My form uses bound text boxes and the 'Add' button appends a blank record. When the text boxes are filled in, and I search for a pre-existing record using the key fields, I find the record I'm adding!!!
>>>
>>>What is the right way to do this? Does it involve public/private datasessions - buffermode settings - etc.?
>>>
>>>Please be specific, this is driving me crazy...
>>>
>>>TIA
>>
>>Usually, INSERT-SQL is preferable to create new records, i.e. you generate unique key first and then use it to get a record.
>
>So is this correct:
>. none of the text boxes should be bound (have a controlsource)
>. text boxes are 'blanked out' using code when the user presses 'Add'
>. if the record is not a dupe, add it using INSERT SQL...
>
>If this is correct, then I'd need code to display the record's data in the proper text box in the form's refresh method. For example:
>
>THISFORM.txtName = CONTACT.NAME
>THISFORM.txtAddr1 = CONTACT.ADDR1
>THISFORM.txtAddr2 = CONTACT.ADDR2
>.

Actually, it depends on way you develop your applications. The things you mentioned are correct for my personal way of doing development. There are many other ways, e.g. many people used to set record pointer to EOF() and use bound controls.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform