This question gets asked suprisingly rarely.
You probably have several tables, set up with one-to-many relations (through
Relationships on the Tools menu.) If you decide that customer 54 is the same
person as customer 22, so you want to merge their records, you need to
reassign all the related records for customer 54 to customer 22. Then, when
customer 54 no longer has any related records, you can delete him.
That means you will need to execute an Update query statement for each table
that has CustomerID as a foreign key. For example, to reassign all records
in tblInvoice you would execute this query:
UPDATE tblInvoice SET CustomerID = 22 WHERE CustomerID = 54;
Do the same for any other related tables. If you want to do this
programmatically, it will look like this:
Dim db As DAO.Database
Dim strSql As String
Set db = dbEngine(0)(0)
strSql = "UPDATE tblInvoice ...
db.Execute strSql, dbFailOnError
strSql = "UPDATE SomeOtherTable SET ...
db.Execute strSql, dbFailOnError
'and so on for other related tables.
strSql = "DELETE FROM tblCustomer WHERE CustomerID = 54;"
db.Execute strSql, dbFailOnError
You probably want to wrap this in a transaction, so you get an
all-or-nothing result.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"mys" <(E-Mail Removed)> wrote in message
news:A14DF1AE-A29D-483F-807D-(E-Mail Removed)...
> hi!i have a customer profile table. some with duplicate names but
> different
> entries on each xc: different date & transaction of the same customer. How
> do
> I merge the details under one customer profile only? So when I open up one
> name I can see all transactions a customer made?
>
> Also, if a customer have two vehicles for example. Can i have only one
> profile for the two vehicles? and under each vehicle are each of their
> service history?
>
> I do have tables for the vehicles and table for the service history but
> most
> are duplicated under the customer profile.
>
> Thanks for all the help