Topic: DUPLICATE RECORD
Hello MVD?
I want to duplicate a line of record in tablegrid by just clicking a button. I need a help on this codes please...
Thanks in advance !
My Visual Database → General → DUPLICATE RECORD
Hello MVD?
I want to duplicate a line of record in tablegrid by just clicking a button. I need a help on this codes please...
Thanks in advance !
procedure Form1_btnDup_OnClick (Sender: TObject; var Cancel: boolean);
begin
SqlExecute('INSERT INTO Table1 (Field1, Field2, Field3, Field4, Field5) '
+ 'SELECT Field1, Field2, Field3, Field4, Field5 FROM Table1'
+ 'WHERE id = ' + Form1.TableGrid1.sqlValue);
Form1.TableGrid1.dbUpdate;
end;
Thanks ehWagner!
My database main tables has a connections to other tables...
Thanks ehWagner!
My database main tables has a connections to other tables...
Just specify in the SQL query all fields, including foreign keys.
Hi Manix,
Another way of doing it is to copy all the values from the selected tablegrid row onto a form.
You don't have to re-type all the details but it also gives you the option to change some of the copied details before saving the record (I'm not sure why you might intentionally want to create duplicates).
Derek.
WOW WOW WEEEEEE
THANKS TO ALL!
Beware of data duplicates, it is the nightmare of database managers!! If you create data duplicates then, you do not understand the purpose of a database. On the long haul you WILL have issues, guaranteed! It is better to query properly than duplicating over and over like you would do with excel spreadshits (pun intended).
The purpose of a database is to store unique data and then query them to display them the way you want. You can have one set of data and display this data in multiple ways: in multiple grids with different filters, in a text summary, in a diagram, etc... Remember: ONE data, multiple ways to display, like one theater screen with multiple viewers looking the very same film but feeling different ways.
YES!
SIR TCOTON, May real purpose to duplicate a line of a record because i have instance that the records has almost the same information only in the amount has a distinction. Sometime this is 10 lines of records... I dont want to type and type it again...
I need a help to solve this problem from the MVD Wizards!
Thanks!
Hi Manix,
Another way of doing it is to copy all the values from the selected tablegrid row onto a form.
You don't have to re-type all the details but it also gives you the option to change some of the copied details before saving the record (I'm not sure why you might intentionally want to create duplicates).
Derek.
Sir Derek!
Help me to include the connected table please..
attached is the sample
Thanks!
manixs2013,
I went ahead and corrected it for you.
YESSSSSSSSSSS
Thanks to : DriveSoft, Tcoton, Derek and ehwagner..
KUDOS to ALL!
After seeing your sample, it seems that there was a misunderstanding with the vocabulary, I thought you were looking to duplicate data within the database at first glance and my brain froze on the keyword "duplicate". Please include your project or a screenshot with your question next time.
My Visual Database → General → DUPLICATE RECORD
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi