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
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
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?
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?
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
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.
ASKER
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks PatHartman, I will try to do it
You're welcome. Don't forget to close the question if this solution works for you.
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.