Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

vb and access

  • 14-02-2005 07:32PM
    #1
    Registered Users, Registered Users 2 Posts: 483 ✭✭


    is there any way of checkin for duplicate records in vb when i try add another one?

    i need it: if a song already exists then msgbox else DBMusic.Recordset.Update
    but i dont know how to do it!
    any help will not go unnoticed!!
    Cheers


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Why not run a Select with the entered details and make sure that 0 records are returned.

    Is this not a better question for the Programming board?


  • Registered Users, Registered Users 2 Posts: 437 ✭✭Spunj


    Been a while since I have used Access but you shoould be able to set up a Unique index made up of Song Name, Artist, Album, Year (or whatever makes a song unique in your db) and then just catch the error that access will throw and handle it gracefully.

    That should save you soing a select query before every insert.


  • Moderators, Politics Moderators, Paid Member Posts: 44,040 Mod ✭✭✭✭Seth Brundle


    This thread is running concurrently in two forums but I'll reply to the busier one!

    Anyway, open one recordset to check if the value exists. If rs.eof then run the insert statement, otherwise display some kind of message to the user.

    Also, Im not sure what way you plan on operating this (does the user type in the name of a song?) but it is possible to have the same song listed with one incorrectly spelled!


Advertisement