Impression

cs_Jackboy Messages postés 757 Date d'inscription vendredi 7 septembre 2001 Statut Membre Dernière intervention 19 juin 2008 - 6 avril 2004 à 16:11
cs_Jackboy Messages postés 757 Date d'inscription vendredi 7 septembre 2001 Statut Membre Dernière intervention 19 juin 2008 - 6 avril 2004 à 19:11
Salut J'ai un trouble d'impression avec excel

Je fais le choix d'un usager et j'imprime ces informations, ici tous est ok. Le problème est quand je fait un second choix et que j'imprime, quelques informations du premier usager entre dans les champs vide du second..

ex.:
usager1 = Réunion : 2:34 Réception : 4:00
usager2 = Réunion : 2:34 Réception : 2:34

mais en fin de compte pour l'usager2 Réunion devraient être égal à 0:00 et non prendre la valeur du premier...

Quoi faire svp !!!!

un peu de mon code :

Private Sub cmdChoix_Click()
Dim AdoTransactions As ADODB.Recordset 'variable pour le recordset

On Error Resume Next
MousePointer = vbHourglass
'fontion pour imprimer rapport sur usager
With deboissons.rscomProduits
'SQL qui indique tous ce qui a dans la table Usager et qui provient du champ IDUsagers
.Source = "Select * From tblPunch where IdUsager='" & txtChoix.Text & "' order by EntrerSortie,HeureEntrer,HeureSortie"
.Open
usager = .Fields(1)
Set AdoTransactions = deboissons.rscomProduits
Call ImprimerRapportTransactionEquipeInfoChoix(AdoTransactions)
.Cancel
.Close

End With

MousePointer = vbArrow
End Sub

Private Sub ImprimerRapportTransactionEquipeInfoChoix(ByVal recInformation As ADODB.Recordset)

Dim xlsobjet As Excel.Application
Dim intcompteur As Integer
Dim calcul As String
Dim CalculTotal
Dim CalculTotal2

On Error Resume Next

'création de l'objet
Set xlsobjet = New Excel.Application

'initialisation du compteur
intcompteur = 5

'If intMise <> 0 Then

'ouverture du document Excel
With xlsobjet.Application

MousePointer = vbHourglass
'les messages normalement affichés ne le seront pas
.DisplayAlerts = False
'ouverture du classeur
.Workbooks.Open (App.Path & "\RapportsExcel.xls")
'activation de la feuille
.Worksheets("HockeyEquipeI").Activate
'écriture des données dans les cellules
recInformation.MoveFirst
Do While Not recInformation.EOF

ApprocheTelephonique = recInformation!ApprocheTelephonique


MiseAJourGaf = recInformation!MiseAJourGaf


SuiviTelephonique = recInformation!SuiviTelephonique


RechercheDeveloppement = recInformation!RechercheDeveloppement


OrganisationEvenement = recInformation!OrganisationEvenement


PreparationSoumission = recInformation!PreparationSoumission


Reception = recInformation!Reception


MiseAJourDossier = recInformation!MiseAJourDossier


MenageBureau = recInformation!MenageBureau


AdministrationsGeneral = recInformation!AdministrationsGeneral


PaieEmployeTA = recInformation!PaieEmployeTA


MiseAJourSC = recInformation!MiseAJourSC


RencontreEmploye = recInformation!RencontreEmploye


RencontreResponsable = recInformation!RencontreResponsable


RencontreFournisseur = recInformation!RencontreFournisseur


RencontreClient = recInformation!RencontreClient


Reunion = recInformation!Reunion


Autres = recInformation!Autres


If ApprocheTelephonique <> "00:00:00" Or ApprocheTelephonique <> "" Then
ApprocheTelephonique2 = CDate(ApprocheTelephonique2) + CDate(ApprocheTelephonique)
End If

If MiseAJourGaf <> "00:00:00" Or MiseAJourGaf <> "" Then
MiseAJourGaf2 = CDate(MiseAJourGaf2) + CDate(MiseAJourGaf)
End If

If SuiviTelephonique <> "00:00:00" Or SuiviTelephonique <> "" Then
SuiviTelephonique2 = CDate(SuiviTelephonique2) + CDate(SuiviTelephonique)
End If

If RechercheDeveloppement <> "00:00:00" Or RechercheDeveloppement <> "" Then
RechercheDeveloppement2 = CDate(RechercheDeveloppement2) + CDate(RechercheDeveloppement)
End If

If OrganisationEvenement <> "00:00:00" Or OrganisationEvenement <> "" Then
OrganisationEvenement2 = CDate(OrganisationEvenement2) + CDate(OrganisationEvenement)
End If

If PreparationSoumission <> "00:00:00" Or PreparationSoumission <> "" Then
PreparationSoumission2 = CDate(PreparationSoumission2) + CDate(PreparationSoumission)
End If

If Reception <> "00:00:00" Or Reception <> "" Then
Reception2 = CDate(Reception2) + CDate(Reception)
End If

If MiseAJourDossier <> "00:00:00" Or MiseAJourDossier <> "" Then
MiseAJourDossier2 = CDate(MiseAJourDossier2) + CDate(MiseAJourDossier)
End If

If MenageBureau <> "00:00:00" Or MenageBureau <> "" Then
MenageBureau2 = CDate(MenageBureau2) + CDate(MenageBureau)
End If

If AdministrationsGeneral <> "00:00:00" Or AdministrationsGeneral <> "" Then
AdministrationsGeneral2 = CDate(AdministrationsGeneral2) + CDate(AdministrationsGeneral)
End If
If PaieEmployeTA <> "00:00:00" Or PaieEmployeTA <> "" Then
PaieEmployeTA2 = CDate(PaieEmployeTA2) + CDate(PaieEmployeTA)
End If

If MiseAJourSC <> "00:00:00" Or MiseAJourSC <> "" Then
MiseAJourSC2 = CDate(MiseAJourSC2) + CDate(MiseAJourSC)
End If

If RencontreEmploye <> "00:00:00" Or RencontreEmploye <> "" Then
RencontreEmploye2 = CDate(RencontreEmploye2) + CDate(RencontreEmploye)
End If

If RencontreResponsable <> "00:00:00" Or RencontreResponsable <> "" Then
RencontreResponsable2 = CDate(RencontreResponsable2) + CDate(RencontreResponsable)
End If

If RencontreFournisseur <> "00:00:00" Or RencontreFournisseur <> "" Then
RencontreFournisseur2 = CDate(RencontreFournisseur2) + CDate(RencontreFournisseur)
End If

If RencontreClient2 <> "00:00:00" Or RencontreClient <> "" Then
RencontreClient2 = CDate(RencontreClient2) + CDate(RencontreClient)
End If

If Reunion <> "00:00:00" Or Reunion <> "" Then
Reunion2 = CDate(Reunion2) + CDate(Reunion)
End If

If Autres <> "00:00:00" Or Autres <> "" Then
Autres2 = CDate(Autres2) + CDate(Autres)
End If

CalculTotal = CDate(ApprocheTelephonique) + CDate(MiseAJourGaf) + _
CDate(SuiviTelephonique) + CDate(RechercheDeveloppement) + _
CDate(OrganisationEvenement) + CDate(PreparationSoumission) + _
CDate(Reception) + CDate(MiseAJourDossier) + _
CDate(MenageBureau) + CDate(AdministrationsGeneral) + _
CDate(PaieEmployeTA) + CDate(MiseAJourSC) + _
CDate(RencontreEmploye) + CDate(RencontreResponsable) + _
CDate(RencontreFournisseur) + CDate(RencontreClient) + _
CDate(Reunion) + CDate(Autres)

CalculTotal2 = CalculTotal2 + CalculTotal
recInformation.MoveNext

Loop
If ApprocheTelephonique2 "00:00:00" Or ApprocheTelephonique2 "" Then
ApprocheTelephonique2 = "0"
End If If MiseAJourGaf2 "00:00:00" Or MiseAJourGaf2 "" Then
MiseAJourGaf2 = "0"
End If If SuiviTelephonique2 "00:00:00" Or SuiviTelephonique2 "" Then
SuiviTelephonique2 = "0"
End If If RechercheDeveloppement2 "00:00:00" Or RechercheDeveloppement2 "" Then
RechercheDeveloppement2 = "0"
End If If OrganisationEvenement2 "00:00:00" Or OrganisationEvenement2 "" Then
OrganisationEvenement2 = "0"
End If If PreparationSoumission2 "00:00:00" Or PreparationSoumission2 "" Then
PreparationSoumission2 = "0"
End If If Reception2 "00:00:00" Or Reception2 "" Then
Reception2 = "0"
End If If MiseAJourDossier2 "00:00:00" Or MiseAJourDossier2 "" Then
MiseAJourDossier2 = "0"
End If If MenageBureau2 "00:00:00" Or MenageBureau2 "" Then
MenageBureau2 = "0"
End If If AdministrationsGeneral2 "00:00:00" Or AdministrationsGeneral2 "" Then
AdministrationsGeneral2 = "0"
End If If PaieEmployeTA2 "00:00:00" Or PaieEmployeTA2 "" Then
PaieEmployeTA2 = "0"
End If If MiseAJourSC2 "00:00:00" Or MiseAJourSC2 "" Then
MiseAJourSC2 = "0"
End If If RencontreEmploye2 "00:00:00" Or RencontreEmploye2 "" Then
RencontreEmploye2 = "0"
End If If RencontreResponsable2 "00:00:00" Or RencontreResponsable2 "" Then
RencontreResponsable2 = "0"
End If If RencontreFournisseur2 "00:00:00" Or RencontreFournisseur2 "" Then
RencontreFournisseur2 = "0"
End If If RencontreClient2 "00:00:00" Or RencontreClient2 "" Then
RencontreClient2 = "0"
End If If Reunion2 "00:00:00" Or Reunion2 "" Then
Reunion2 = "0"
End If If Autres2 "00:00:00" Or Autres2 "" Then
Autres2 = "0"
End If

'impression de la colonne des heures fait par catégorie
.Range("G" & Trim(Str(3))).Value = ApprocheTelephonique2
.Range("G" & Trim(Str(4))).Value = MiseAJourGaf2
.Range("G" & Trim(Str(5))).Value = SuiviTelephonique2
.Range("G" & Trim(Str(6))).Value = RechercheDeveloppement2
.Range("G" & Trim(Str(7))).Value = OrganisationEvenement2
.Range("G" & Trim(Str(8))).Value = PreparationSoumission2
.Range("G" & Trim(Str(9))).Value = Reception2
.Range("G" & Trim(Str(10))).Value = MiseAJourDossier2
.Range("G" & Trim(Str(11))).Value = MenageBureau2
.Range("G" & Trim(Str(12))).Value = AdministrationsGeneral2
.Range("G" & Trim(Str(13))).Value = PaieEmployeTA2
.Range("G" & Trim(Str(14))).Value = MiseAJourSC2
.Range("G" & Trim(Str(15))).Value = RencontreEmploye2
.Range("G" & Trim(Str(16))).Value = RencontreResponsable2
.Range("G" & Trim(Str(17))).Value = RencontreFournisseur2
.Range("G" & Trim(Str(18))).Value = RencontreClient2
.Range("G" & Trim(Str(19))).Value = Reunion2
.Range("G" & Trim(Str(20))).Value = Autres2
.Range("G" & Trim(Str(22))).Value = CalculTotal2
recInformation.MoveFirst

.Range("A" & Trim(Str(1))).Value = "Rapport de : " & usager

Do While Not recInformation.EOF
'.Range("A" & Trim(Str(1))).Value = "Rapport de : " & recInformation!NomUsager
.Range("A" & Trim(Str(intcompteur))).Value = recInformation!NomUsager
.Range("B" & Trim(Str(intcompteur))).Value = recInformation!IdUsager
.Range("C" & Trim(Str(intcompteur))).Value = recInformation!EntrerSortie
.Range("D" & Trim(Str(intcompteur))).Value = recInformation!HeureEntrer
.Range("E" & Trim(Str(intcompteur))).Value = recInformation!HeureSortie

recInformation.MoveNext

If intcompteur = 35 Then
intcompteur = 47
End If
If intcompteur = 78 Then
intcompteur = 89
End If
If intcompteur = 120 Then
intcompteur = 131
End If
If intcompteur = 162 Then
intcompteur = 173
End If
If intcompteur = 204 Then
intcompteur = 215
End If
If intcompteur = 246 Then
intcompteur = 257
End If
If intcompteur = 288 Then
intcompteur = 299
End If

intcompteur = intcompteur + 1
Loop
intcompteur = intcompteur + 1


.ActiveSheet.PrintOut 'impression du document

gintStyle = vbOKOnly + vbExclamation
gstrTitre = "Imprimerie..."
gstrMessage = "L'impression est terminé, merci!"
gintReponse = MsgBox(gstrMessage, gintStyle, gstrTitre)
End With
'End If
'destruction de toute référence à l'objet
xlsobjet.Quit
Set xlsobjet = Nothing

End Sub

1 réponse

cs_Jackboy Messages postés 757 Date d'inscription vendredi 7 septembre 2001 Statut Membre Dernière intervention 19 juin 2008
6 avril 2004 à 19:11
ouiblier sa tous est ok........................ mes variable general qui bugait....
0
Rejoignez-nous