[Access]

Bonjour,
j'ai 3 tables dans access
http://img61.imageshack.us/img61/2766/relationbt2.jpg
je voudrais pouvoir afficher un message si le livre a déjà été emprunté. et bloquer le nouvel emprunt. Mais comment faire ?
Merci de me répondre rapidement
Configuration: Windows XP
Firefox 2.0.0.3

3 réponses

  1. si c'est pour verifier qu'il a ete emprunté par un stagiaire precis

    Ce que je vais te proposer est en VBa

    Sql = "SELECT Emprunt.Referencestagiaire FROM Emprunt"
    Sql = Sql & " WHERE (((Emprunt.Referencestagiaire ) = "refstagiaire que tu veut")) "
    Sql=Sql & "UNION"
    Sql=Sql & "SELECT Emprunt.Referencelivre FROM Emprunt"
    Sql = Sql & " WHERE (((Emprunt.Referencelivre) = "reflivre que tu veut")) "

    DoCmd.DeleteObject acQuery, "ref"
    CurrentDb.CreateQueryDef "ref", Sql

    Set Qry = CurrentDb.QueryDefs("ref")
    Set rs = Qry.OpenRecordset

    if not rs.eof then
    MsgBox("Ce livre a deja ete emprunté par ce stagiaire")
    else
    tu mets ici le code pour emprunter le livre
    end if

    Set Qry = Nothing
    Set rs = Nothing
    1. SALUT A TOUS
      G LE MEME SOUCI MAIS JE N Y ARIVE PA EN VBA
      G MI UNE TABLE RETOUR EN PLUS DE LA TABLE EMPRUNT
      EN PLUS JE VEUX RESTREINDRE LE NOMBRE DE SUPPORTS (CD DVD K7 LIVRE) A TROIS !!

      MERCI DE VOTRE AIDE