begin process at 2012 02 16 00:00:32
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Base de Donnees

 > GESTION DES CD

GESTION DES CD


 Information sur la source

Note :
9 / 10 - par 2 personnes
9,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Base de Donnees Classé sous :yms, gestioncd, vbaccess Niveau :Débutant Date de création :25/02/2006 Vu / téléchargé :11 546 / 5 197

Auteur : yms

Ecrire un message privé
Site perso
Commentaire sur cette source (1)
Ajouter un commentaire et/ou une note

 Description

Cliquez pour voir la capture en taille normale
gestion des cd, code debutant , vb/access

Source

  • Dim opt As String
  • Option Explicit
  • Option Compare Text ' binary '
  • Public bd As Database
  • Public util As Recordset
  • Sub textshow(o As Boolean)
  • matricul.Enabled = o
  • nom.Enabled = o
  • contenu.Enabled = o
  • autre.Enabled = o
  • oui.Enabled = o
  • non.Enabled = o
  • typelist.Enabled = o
  • cdlist.Enabled = o
  • End Sub
  • Sub boutonshow(o As Boolean)
  • ajout.Enabled = o
  • modif.Enabled = o
  • suppr.Enabled = o
  • cherch.Enabled = o
  • valider.Enabled = Not o
  • annuler.Enabled = Not o
  • prem.Enabled = o
  • prec.Enabled = o
  • suiv.Enabled = o
  • dern.Enabled = o
  • End Sub
  • Sub afficher()
  • Dim i As Integer
  • With util
  • matricul = !matricul
  • nom = !nom
  • contenu = !contenu
  • autre = !autre
  • oui.Value = False
  • non.Value = False
  • If !Type <> "" Then
  • For i = 0 To 6
  • If !Type = typelist.List(i) Then
  • typelist.ListIndex = i
  • End If
  • Next i
  • End If
  • If !cd <> "" Then
  • For i = 0 To 1
  • If !cd = cdlist.List(i) Then
  • cdlist.ListIndex = i
  • End If
  • Next i
  • End If
  • Select Case !disponible
  • Case "oui"
  • oui.Value = True
  • Case "non"
  • non.Value = True
  • End Select
  • End With
  • End Sub
  • Private Sub ajout_Click()
  • matricul = ""
  • nom = ""
  • contenu = ""
  • autre = ""
  • oui.Value = False
  • non.Value = False
  • typelist.ListIndex = -1
  • cdlist.ListIndex = 0
  • util.AddNew
  • Call textshow(True)
  • Call boutonshow(False)
  • End Sub
  • Private Sub annuler_Click()
  • Call textshow(False)
  • Call boutonshow(True)
  • Call prec_Click
  • Call suiv_Click
  • End Sub
  • Private Sub cherch_Click()
  • Dim nom As String
  • Dim ret As VbCallType
  • If util.RecordCount <> 0 Then
  • ret = MsgBox("OUI pour une rechercher par *Nom* //NON pour une recherche par *Matricule* : ", vbYesNoCancel + vbQuestion)
  • If ret = vbYes Then
  • nom = InputBox("Entrer le nom du CD/DVD : ", "Recherche : Par Nom")
  • nom = "[nom]='" & nom & "'"
  • End If
  • If ret = vbNo Then
  • nom = InputBox("Entrer le Numero du Matricule : ", "Recherche : Par Matricul ")
  • nom = "[matricul]='" & nom & "'"
  • End If
  • If ret <> vbCancel Then
  • util.FindFirst (nom)
  • If Not util.NoMatch Then
  • Call afficher
  • Else
  • MsgBox " aucun resultat trouver ", vbOKOnly + vbInformation
  • End If
  • End If
  • Else
  • MsgBox " aucune information n'est enregistrer ! ", vbOKOnly + vbCritical
  • End If
  • End Sub
  • Private Sub dern_Click()
  • If util.RecordCount <> 0 Then
  • util.MoveLast
  • Call afficher
  • End If
  • End Sub
  • Sub ouvrir()
  • Set bd = OpenDatabase("cd1.mdb")
  • Set util = bd.OpenRecordset("mescd", dbOpenDynaset)
  • End Sub
  • Private Sub Form_Load()
  • Call ouvrir
  • Call prem_Click
  • typelist.AddItem "film"
  • typelist.AddItem "program"
  • typelist.AddItem "jeu"
  • typelist.AddItem "music"
  • typelist.AddItem "etude"
  • typelist.AddItem "islam"
  • typelist.AddItem "autre"
  • cdlist.AddItem "CD"
  • cdlist.AddItem "DVD"
  • If util.RecordCount <> 0 Then
  • Call afficher
  • Else
  • MsgBox " aucune information n'est enregistrer ! ", vbOKOnly + vbCritical
  • End If
  • Call textshow(False)
  • Call boutonshow(True)
  • End Sub
  • Private Sub modif_Click()
  • If util.RecordCount <> 0 Then
  • util.Edit
  • Call textshow(True)
  • Call boutonshow(False)
  • Else
  • MsgBox " aucune information n'est enregistrer ! ", vbOKOnly + vbCritical
  • End If
  • End Sub
  • Private Sub prec_Click()
  • If util.RecordCount <> 0 Then
  • util.MovePrevious
  • If util.BOF Then
  • util.MoveLast
  • End If
  • Call afficher
  • End If
  • End Sub
  • Private Sub prem_Click()
  • If util.RecordCount <> 0 Then
  • util.MoveFirst
  • Call afficher
  • End If
  • End Sub
  • Private Sub quitter_Click()
  • End
  • End Sub
  • Private Sub suiv_Click()
  • If util.RecordCount <> 0 Then
  • util.MoveNext
  • If util.EOF Then
  • util.MoveFirst
  • End If
  • Call afficher
  • End If
  • End Sub
  • Private Sub suppr_Click()
  • Dim ret As VbCallType
  • If util.RecordCount <> 0 Then
  • ret = MsgBox("Etes vous sure de vouloire supprimer " + nom + " ?", vbCritical + vbYesNo, "Confirmer")
  • If ret = vbYes Then
  • util.Delete
  • Call prec_Click
  • If util.RecordCount <> 0 Then
  • Call afficher
  • End If
  • End If
  • Else
  • MsgBox " Aucune information n'est enregistré ! ", vbOKOnly + vbCritical
  • End If
  • End Sub
  • Private Sub valider_Click()
  • Call textshow(False)
  • Call boutonshow(True)
  • With util
  • !nom = nom
  • !matricul = matricul
  • !contenu = contenu
  • !autre = autre
  • !Type = typelist.List(typelist.ListIndex)
  • !cd = cdlist.List(cdlist.ListIndex)
  • If oui.Value = True Then
  • !disponible = "oui"
  • Else
  • If non.Value = True Then
  • !disponible = "non"
  • End If
  • End If
  • End With
  • util.Update
  • End Sub
Dim opt As String

Option Explicit
Option Compare Text ' binary '
Public bd As Database
Public util As Recordset
Sub textshow(o As Boolean)
matricul.Enabled = o
nom.Enabled = o
contenu.Enabled = o
autre.Enabled = o
oui.Enabled = o
non.Enabled = o
typelist.Enabled = o
cdlist.Enabled = o
End Sub
Sub boutonshow(o As Boolean)
ajout.Enabled = o
modif.Enabled = o
suppr.Enabled = o
cherch.Enabled = o

valider.Enabled = Not o
annuler.Enabled = Not o

prem.Enabled = o
prec.Enabled = o
suiv.Enabled = o
dern.Enabled = o

End Sub

Sub afficher()
Dim i As Integer
With util
matricul = !matricul
nom = !nom
contenu = !contenu
autre = !autre
oui.Value = False
non.Value = False

If !Type <> "" Then
For i = 0 To 6
If !Type = typelist.List(i) Then
  typelist.ListIndex = i
End If
Next i
End If

If !cd <> "" Then
For i = 0 To 1
If !cd = cdlist.List(i) Then
  cdlist.ListIndex = i
End If
Next i
End If

Select Case !disponible
  Case "oui"
     oui.Value = True
  Case "non"
     non.Value = True
End Select
End With
End Sub

Private Sub ajout_Click()
matricul = ""
nom = ""
contenu = ""
autre = ""
oui.Value = False
non.Value = False
typelist.ListIndex = -1
cdlist.ListIndex = 0
util.AddNew
Call textshow(True)
Call boutonshow(False)
End Sub

Private Sub annuler_Click()
Call textshow(False)
Call boutonshow(True)
Call prec_Click
Call suiv_Click
End Sub

Private Sub cherch_Click()
Dim nom As String
Dim ret As VbCallType
If util.RecordCount <> 0 Then
 ret = MsgBox("OUI pour une rechercher par *Nom* //NON pour une recherche par *Matricule* : ", vbYesNoCancel + vbQuestion)
 If ret = vbYes Then
   nom = InputBox("Entrer le nom du CD/DVD : ", "Recherche : Par Nom")
   nom = "[nom]='" & nom & "'"
 End If
 If ret = vbNo Then
   nom = InputBox("Entrer le Numero du Matricule : ", "Recherche : Par Matricul ")
   nom = "[matricul]='" & nom & "'"
 End If
 If ret <> vbCancel Then
   util.FindFirst (nom)
   If Not util.NoMatch Then
     Call afficher
   Else
   MsgBox "     aucun resultat trouver    ", vbOKOnly + vbInformation
   End If
 End If
Else
  MsgBox " aucune information n'est enregistrer ! ", vbOKOnly + vbCritical
End If
End Sub

Private Sub dern_Click()
If util.RecordCount <> 0 Then
  util.MoveLast
  Call afficher
  End If
End Sub
Sub ouvrir()
Set bd = OpenDatabase("cd1.mdb")
Set util = bd.OpenRecordset("mescd", dbOpenDynaset)
End Sub

Private Sub Form_Load()
Call ouvrir
Call prem_Click
typelist.AddItem "film"
typelist.AddItem "program"
typelist.AddItem "jeu"
typelist.AddItem "music"
typelist.AddItem "etude"
typelist.AddItem "islam"
typelist.AddItem "autre"
cdlist.AddItem "CD"
cdlist.AddItem "DVD"

If util.RecordCount <> 0 Then
Call afficher
Else
MsgBox " aucune information n'est enregistrer ! ", vbOKOnly + vbCritical
End If
Call textshow(False)
Call boutonshow(True)
End Sub

Private Sub modif_Click()
If util.RecordCount <> 0 Then
util.Edit
Call textshow(True)
Call boutonshow(False)
Else
MsgBox " aucune information n'est enregistrer ! ", vbOKOnly + vbCritical
End If

End Sub

Private Sub prec_Click()
 If util.RecordCount <> 0 Then
util.MovePrevious
If util.BOF Then
 util.MoveLast
End If
Call afficher
End If
End Sub

Private Sub prem_Click()
If util.RecordCount <> 0 Then
  util.MoveFirst
  Call afficher
  End If
End Sub

Private Sub quitter_Click()
End
End Sub

Private Sub suiv_Click()
  If util.RecordCount <> 0 Then
util.MoveNext
If util.EOF Then
 util.MoveFirst
 End If
Call afficher
End If
End Sub

Private Sub suppr_Click()
Dim ret As VbCallType
If util.RecordCount <> 0 Then
ret = MsgBox("Etes vous sure de vouloire supprimer " + nom + " ?", vbCritical + vbYesNo, "Confirmer")
If ret = vbYes Then
util.Delete
Call prec_Click
If util.RecordCount <> 0 Then
Call afficher
End If
End If
Else
MsgBox " Aucune information n'est enregistré ! ", vbOKOnly + vbCritical
End If

End Sub

Private Sub valider_Click()
   Call textshow(False)
   Call boutonshow(True)
   With util
    !nom = nom
    !matricul = matricul
    !contenu = contenu
    !autre = autre
    !Type = typelist.List(typelist.ListIndex)
    !cd = cdlist.List(cdlist.ListIndex)
    If oui.Value = True Then
      !disponible = "oui"
    Else
     If non.Value = True Then
       !disponible = "non"
     End If
    End If
   End With
   util.Update
   
End Sub

 Conclusion

code debutant pour apprendre a gerer une base de donnee access sur vb
yms

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

Source avec Zip Source avec une capture GESTION DE STOCK D'UNE SOCIETÉ DE VENTE DE MATERIEL INFORMAT...

 Sources de la même categorie

Source avec Zip Source avec une capture BIEN ADMINISTRER LES ETUDIANTS ET LEURS CÔTES par okosa
Source avec Zip VBA EXEL GESTION DE PERSONEL NOUVEAU CONTRAT DE TRAVAI par oudlarbi
Source avec Zip Source avec une capture CREATION D'UN OBJET D'ACCÈS AUX DONNÉES par okosa
Source avec Zip Source .NET (Dotnet) MISAHORAIRE par MdelM
Source avec Zip Source avec une capture BASEDEDONNEES,GESTIONDEMALADES,DATABASSE par shadkitenge

 Sources en rapport avec celle ci

TRANSFERT DONNÉES ACCESS par l0r3nz1
Source avec Zip DÉTECTEUR DE PROCÉDURES ET FONCTIONS INUTILISÉES par 8Tnerolf8
Source avec Zip Source avec une capture GESTION DE STOCK D'UNE SOCIETÉ DE VENTE DE MATERIEL INFORMAT... par yms

Commentaires et avis

Commentaire de achille1985 le 20/04/2009 16:17:04

bonjour
bon voila j'ai lu le programme mais j'arrive pas à voir comment la connexion entre le vb et l'access s'est faite.
priere de me l'expliquer ou de m'envoyer un email sur achille1985@hotmail.com
merci d'avance

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

MAJ auto sous VBAccess [ par Clonk ] Salut!J'ai un probleme sous VBA (j'm'y connais pas des masses non plus)...Voilà : j'aimerais executer une requête (stockée de préférence) qui mettrait [VBAccess 2000]Détérioration d'une base Access en réseau et plantage [ par Archi31 ] Bonjour, J'ai une base Access 2000 en réseau avec Frontal sur les postes utilisateurs et Données sur le réseau avec attachement des tables à l'ouvertu tableau en vbaccess [ par guylux ] bonjourj'utilise une fonction qui doit me renvoyer un tableau a 2 dimensionspb: je ne sais pas comment le declarer"function xxxxxx() as string"qui ren vbaccess + nregistrement etat [ par deubal ] slt tout le mondeJe fais du vbaccess. j'ai donc des formulaires de saisie et des etats qui en decoulent. je voudrais en cliquant sur un bouton enregis vbaccess et comparaison de requetes [ par deubal ] slt tout le mondeje suis dans vbaccess. lors de l'ouverture de ma base de donnees je souhaite mettre a jour une table avec des infos modifiées dans un vbaccess cle primaire [ par deubal ] slt tout le monde,dans mon projet access , j'ai une table qui provient d'une autre base de donnees et qui est liee,sans cle primaire avec +450 enregis vbaccess : formulaire de vue de l'arborescence pour trouver un fichier [ par deubal ] salut tout le monde,je voudrai integrer dans un des formulaires de ma bdd access, la possibilite a l'utilisateur de rechercher dans l'arborescence un VBAccess : Nouvel enregistrement [ par duodiscus ] salut :) j'ai r&#233;alis&#233; un logiciel de saisie de formulaireet en fait quand j'ouvre le formulaire pour saisir &#224; nouveau, il forc&#233;men VBAccess Methode ApplyFilter [ par or_eli ] Bonjour à tous, j'ai crée un formulaire en Access gérant les baux de plusieurs immeubles. j'ai fait un filtre par immeuble en appliquant la methode A VBaccess [ par Essaid_111 ] bonjour toule monde!Est ce que vous pouvez m'aider à réaliser une recherche par plusieurs critéres dans l'access en utilisant le vb6?


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 5,148 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales