Link to home
Start Free TrialLog in
Avatar of adamdaban daban
adamdaban daban

asked on

VBA duplicated Data

Hi everyone,
  I have one question about duplicated value, for example, If we have continuous form when we input data more than once this value should add one and remove duplicate data how we can do it by VBA?
id       name      price   number

1        cola          20            2


thanks for any advice and solution
Avatar of Fabrice Lambert
Fabrice Lambert
Flag of France image

Erm, I see that you have an "id" data.
Often this mean it is a primary key, wich prevent from entering duplicate records.

Plus manipulating continuous forms with VBA is fairly difficult, better leave that job to MS Access.
your problem statement is unclear.  Whether the form is single, continuous, or DS is not relevant.  What is the set of unique columns?  Do you really want to add duplicate rows but just add an additional column with a sequence number?

Try to restate this using business terms.  Is a person doing the data entry?  where are the values coming from?  Why do you want to allow duplicates?  

The data fields you showed do not make sense to allow duplicates.  I don't know what ID is but the Name column should be unique.  That means there should be only a single price for each Name.  If you allowed multiple prices for a given product, how would you know which one to use?
Avatar of adamdaban daban
adamdaban daban

ASKER

Thanks for replying, my question is, for example, I want to add 1 Coca-Cola  and again add one more to the table I want only show one coca-cola with 2 quantity
item            number
coca-cola                         2

not like this

item            number
coca-cola                         1
coca-cola                         1
Can you please tell us the business case and what you are counting.
I have the plan to make the small project for cashier system so I want  in my form when I add Items  if data is duplicated only increase  a number
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks PatHartman, I will try to do it
You're welcome.  Don't forget to close the question if this solution works for you.