Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

vb and access

  • 14-02-2005 6: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 Posts: 41,239 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