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

  • 15-02-2005 8:58am
    #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 im not sure how to do it!
    any help will not go unnoticed!!
    Cheers


Comments

  • Registered Users, Registered Users 2 Posts: 340 ✭✭Trizo


    You could have a select statement checking for the entry in the datatbase, if the number of rows returned = 0 then it is'nt a duplicate anything else means its already there.


  • Registered Users, Registered Users 2 Posts: 1,184 ✭✭✭causal


    banbutcher wrote:
    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 im not sure how to do it!
    any help will not go unnoticed!!
    Cheers

    I'm a bit rusty at VB and Access, but:

    How are you specifying that a song already exists
    - is it based on the song 'name', or some code?

    Whatever it is - make that column unique within it's table, in your database definition.

    In your VB code - update the database with the song details - catch any error thrown (record already exists, whatever) by the database in your VB code and then open your message box if necessary.

    Basically - let the database handle checking whether the song is already there.

    causal


  • Registered Users, Registered Users 2 Posts: 950 ✭✭✭jessy


    yep agree with Trizo, a simple SQL query will do it.


  • Registered Users, Registered Users 2 Posts: 640 ✭✭✭Kernel32


    I agree with casual. Keep the data integrity rules in the database. Databases out live application front ends and having an index is the most efficent way of handling the problem.


Advertisement