Results 1 to 2 of 2

Thread: Finding duplicate varaiable values

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 1999
    Location
    Columbus, OH
    Posts
    1

    Post

    A note before I begin: I am pretty new to VB and am working on an assignment for my employer. Please, don't laugh at what I am about to ask.

    I am working on a database application in Access. Basicially, it is a customer lookup program. One of its functions is that the user can lookup customers by ID # and then create bills for them. For each time the user does this, they begin by creating a bill list. They then select a user record and create a bill which then ends up in the bill list.

    My problem is this: There is a variable, CouponID. If the user accidently creates two bills for the same customer for the same amount, there ends up being duplicate listings and also duplicate CouponIDs. There is a delete button next to each of these listings. What i am trying to do with this button is when the user clicks on, it searches the rest of the listing for multiple occurences of the same CouponID, warns the user about the multiple occurences, then gives the user an option to delete all occurences or to delete all but one occurence.

    Where I am stuck is creating code that will actually find multiple occurences of the same CouponID.

    Suggestions?

    -N

  2. #2
    New Member
    Join Date
    Apr 1999
    Posts
    4

    Post

    Try storing CouponID in a variable and then searching through the database looking for a match and incrementing a counter variable if a match is found. ie:

    If VariableName = CouponID Then
    counter = counter + 1
    End If

    This would allow you to track the number of times a match is found.

    Hope this helps

    David Ridgway
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width