IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBA Access Discussion :

[VBA-A] Pb avec type Date


Sujet :

VBA Access

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    95
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 95
    Par défaut [VBA-A] Pb avec type Date
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    Option Compare Database
    Private Sub Form_Current()
    Dim Mois As Date
    Dim Jours As Date
    Dim Année As Date
    Dim LaDate As Variant
    ' Recupération du jours,du moi et de l'année
    Jours = Mid(Date - 1, 1, 2)
    Mois = Mid(Date, 4, 2)
    Année = Mid(Date, 7, 4)
    ' On choisit le fichier de destinantion suivant le moi
    'Recuperation du nom du ficher .dat et copi dans <a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\</a>
    If Mois = "01" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Janvier\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Janvier\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "02" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Fevirer\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Fevirer\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "03" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Mars\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Mars\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "04" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Avril\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Avril\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "05" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Mai\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Mai\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "06" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Juin\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Juin\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "07" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Juillet\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Juillet\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "08" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Aout\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Aout\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "09" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Septembre\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Septembre\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "10" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Octobre\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Octobre\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "11" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Novembre\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Novembre\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
    If Mois = "12" Then
    FileCopy "<a href="file://\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir" target="_blank">\\srvdfs00\partages\651-700\M00686\Siebel\Reseau\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".dat", "<a href="file://\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Decembre\CRM21_Fir" target="_blank">\\srvdfs00\partages\501-550\m00549\APTECH\Projet\fichier\Decembre\CRM21_Fir</a>_" & Année & "" & Mois & "" & Jours & ".txt"
    End If
     
    End Sub

    Voici mon code : j'ai un souci avec le type Date je ne comprend pas pour quoi il n'est pas reconnu sous acces. Le message d'erreur est le suivant :

    Erreur de compilation Projet ou bibliothèque introuvable
    J'ai vu aparement le type Date existe egalement sous access et aps seulement sous excel .

    PS: ce code fonctionne sous excel.

    Merci . Antoine

  2. #2
    Membre Expert
    Avatar de pc75
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    3 662
    Détails du profil
    Informations personnelles :
    Âge : 70
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Septembre 2004
    Messages : 3 662
    Par défaut
    Bonjour,

    Au lieu de faire :

    Jours = Mid(Date - 1, 1, 2)
    Mois = Mid(Date, 4, 2)
    Année = Mid(Date, 7, 4)
    Pourquooi ne fais tu pas ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    Jours = Day(Date)
    Mois = Month(Date)
    Année = Year(Date)

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    95
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 95
    Par défaut
    Oui c'est sur c'est mieu effectivement ! Mais sa ne marche toujours pas sous access toujours le meme souci !! Mais merci pour l'info !!



    Antoine

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    95
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 95
    Par défaut
    un ptit up avant de dodo!!

    A dmain.

  5. #5
    Expert éminent


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Par défaut
    [
    Citation Envoyé par toniox
    Voici mon code : j'ai un souci avec le type Date je ne comprend pas pour quoi
    Vérifie les références de ton projet... si tu as une référence "Manquante" (pas forcément liée à la date) VBA peu se "vautrer" dans la recherche des types...

  6. #6
    Membre Expert
    Avatar de pc75
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    3 662
    Détails du profil
    Informations personnelles :
    Âge : 70
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Septembre 2004
    Messages : 3 662
    Par défaut
    Re,

    Et puis fais attention, les fonctions sur les dates te renvoient une valeur numérique ; donc, par exemple, Month(now) => 5 et non pas "05".

  7. #7
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    95
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 95
    Par défaut
    Qu'elle sont les references que vous utiliser dans access??

    Merci .Antoine

  8. #8
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    95
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 95
    Par défaut
    SVP messieurs j'ai tout essayer la et j'ai toujours le meme prob je bloque pour afficher une date je vais devenir dingue !!

    Si vous pouvez me filer un ptit tuyau j'ai activé les même reference que sous excel sur lequelle la onciton tourne !

    Merci beaoucoup !

  9. #9
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    95
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 95
    Par défaut
    L'expression sur ouverture entrée comme paramètre de la propriétéde type événement est à l'origine d'une erreur .Un problème est survenu durant le communication entre Micro Access et le serveur OLE ou le contrôle ActiveX

    * le resultat de l'expression n'est pas le nom d'une macro ,le nom d'une fonction définie par l'utilisateur ou [event procedure]
    *Une erreur a peut etre été commise lors de l'evaluation d'une fonction ,d'un evt d'une macro.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 4
    Dernier message: 06/07/2010, 11h53
  2. [Oracle] type date: comparaison avec l'année en cours
    Par zchallal dans le forum Langage SQL
    Réponses: 1
    Dernier message: 21/06/2006, 07h39
  3. Problème udpate avec un type Date
    Par kevinp dans le forum Général Dotnet
    Réponses: 3
    Dernier message: 17/05/2006, 06h09
  4. [VBA-E] Problème avec des dates !
    Par yaya54 dans le forum Macros et VBA Excel
    Réponses: 5
    Dernier message: 21/03/2006, 13h12
  5. Pb avec une dbgrid et un champ de type date
    Par Ellde dans le forum Bases de données
    Réponses: 1
    Dernier message: 17/03/2005, 16h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo