Solved

adding item to list view exits sub if its a duplicate.

Posted on 2004-08-18
2
269 Views
Last Modified: 2010-05-02
how can i add a item to a listview while having it exit sub if its a duplicate?
0
Comment
Question by:andyakira
2 Comments
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 250 total points
ID: 11837894
Try use FindItem method, like:

...
Dim tmpItem As ListItem, i As Integer
    Set tmpItem = listview1.FindItem(mytext)
    If tmpItem Is Nothing Then
        i = listview1.ListItems.Count + 1
        'listview1.Sorted = False
        listview1.ListItems.Add i, , myext
        'listview1.Sorted = True
    End If
...

cheers
0
 

Author Comment

by:andyakira
ID: 11837935
works great, ty
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now