How to control duplicates

jchal

Active Member
Licensed User
Longtime User
i have a tale and i have allow to take duplicates but then i want to collect them i am writing a bar code scanner software
every time tyhe scaner scans the same item i put 1 for quantity but but if i scan 5 items the quantity must be 5
can anybody help?
 

Ricky D

Well-Known Member
Licensed User
Longtime User
try this

Are you using an SQLite database to store them? Or are you just putting them into the table?

In SQL you'd use
cmd is a Command object, reader is a DataReader object

If IsNull(reader.Value)=false Then reader.close
sqlText="Select Count(BarCode) as BarCodeCount Where BarCode=yourbarcodevalue"
cmd.CommandText=sqlText
reader.Value=cmd.ExecuteReader
reader.ReadNextRow

the result comes back in reader.GetValue(0)

The 1st line makes sure the reader is closed. If it isn't closed you get a runtime error when you try to use the command object.

I hope this helps.

If you're doing it from the table then set a filter and get the rowcount

Table1.Filter("BarCode='" & yourbarcode & "'")
Msgbox(Table1.RowCount)
Table1.Filter("") clears the filter


regards, Ricky
 
Top