begin process at 2012 02 17 11:16:18
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Visual Basic 6

 > 

Divers

 > 

Débutants

 > 

probleme avec acces , sur recherche dans la table


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

probleme avec acces , sur recherche dans la table

mercredi 11 mars 2009 à 22:28:56 | probleme avec acces , sur recherche dans la table

petiflamand

voici mon code
Set db = OpenDatabase(App.Path & "\manager.mdb")
Set rs = db.OpenRecordset("ticket")
If rs.RecordCount > 0 Then
rs.MoveFirst
'cont = rs!nticket
Do Until rs.EOF = True
If rs!Date = principale.Text4 Then
toc = rs!nticket
If cont <> rs!nticket Then
nb_ticket = nb_ticket + 1
'----------------------------------------------

    MSFlexGrid1.AddItem ("1")
    MSFlexGrid1.Row = MSFlexGrid1.Rows - 1
    MSFlexGrid1.col = 1
    MSFlexGrid1.Text = toc
    MSFlexGrid1.col = 2
    MSFlexGrid1.Text = rs!Date
    MSFlexGrid1.col = 3
    MSFlexGrid1.Text = rs!heure
    MSFlexGrid1.col = 4
    Set rd = db.OpenRecordset("select SUM(ticket.TOTAL) As TOTALPlus ,nticket from ticket WHERE ticket.nticket=" & toc & " and ticket.opa='+'  group by nticket")
    On Error GoTo erreur4
    totalplus = rd!totalplus
    Set rr = db.OpenRecordset("select SUM(ticket.TOTAL) As TOTALMoin ,nticket FROM ticket WHERE ticket.nticket=" & toc & " and ticket.opa='-' group by nticket")
    On Error GoTo erreur5
    totalmoin = rr!totalmoin
    On Error GoTo erreur3

If totalmoin > 0 Then
MSFlexGrid1.Text = Format(totalplus, "###0.00") - Format(totalmoin, "###0.00")
Else
MSFlexGrid1.Text = Format(rd!totalplus, "###0.00")
End If
MSFlexGrid1.col = 5
MSFlexGrid1.Text = rs!mode_pay


End If
cont = rs!nticket
End If
rs.MoveNext

'cont = rs!nticket
Loop
End If

VOICI MA TABLE

shift
nticket ncaisse date heure cod_prod design departement numero_dep tva mode_pay opa prix_achat prix_vente quantité pvente mois année TOTAL NF total_achat
180823 thierry 11/03/2009 07:06:58 5410133810035 rizla grise CIGARETTES 21 2 21 cash + 0,00 € 0,80 € 1 0,8

0,80 € Non 0,00 €
180823 thierry 11/03/2009 07:07:00 5010891011868 RIZLA LONGUE CIGARETTES 21 2 21 cash + 0,00 € 0,90 € 1 0,9

0,90 € Non 0,00 €
180824 thierry 11/03/2009 07:11:01 54027060 MARLBORO CIGARETTES 1 0 bancontact + 0,00 € 4,40 € 1 4,4

4,40 € Non 0,00 €
180824 thierry 11/03/2009 07:11:01 54027060 MARLBORO CIGARETTES 1 0 bancontact + 0,00 € 4,40 € 1 4,4

4,40 € Non 0,00 €
180824 thierry 11/03/2009 07:11:06 40099293 FREEDENT CHLORO SHOP 6 4 6 bancontact + 0,00 € 1,00 € 1 1

1,00 € Non 0,00 €
180824 thierry 11/03/2009 07:11:07 40099293 FREEDENT CHLORO SHOP 6 4 6 bancontact + 0,00 € 1,00 € 1 1

1,00 € Non 0,00 €
180824 thierry 11/03/2009 07:11:07 40099293 FREEDENT CHLORO SHOP 6 4 6 bancontact + 0,00 € 1,00 € 1 1

1,00 € Non 0,00 €
180824 thierry 11/03/2009 07:11:07 40099293 FREEDENT CHLORO SHOP 6 4 6 bancontact + 0,00 € 1,00 € 1 1

1,00 € Non 0,00 €
180825 thierry 11/03/2009 07:12:14 2 EURO SUPER 95 CARBURANT EURO 91 21 bancontact + 0,00 € 1,23 € 12 15,17823

15,18 € Non 0,00 €
180826 thierry 11/03/2009 07:13:42 87196931 KENT CIGARETTES 1 0 cash + 0,00 € 4,40 € 1 4,4

4,40 € Non 0,00 €
180826 thierry 11/03/2009 07:13:43 87196931 KENT CIGARETTES 1 0 cash + 0,00 € 4,40 € 1 4,4

4,40 € Non 0,00 €
180827 thierry 11/03/2009 07:16:44 5413635023347 LA MEUSE LIBRAIRIE B 21 0 cash + 0,00 € 1,00 € 1 1

1,00 € Non 0,00 €
180828 thierry 11/03/2009 07:17:05 90162909 RED BULL SHOP 6 4 6 cash + 0,00 € 1,80 € 1 1,8

1,80 € Non 0,00 €
180828 thierry 11/03/2009 07:17:07 90162909 RED BULL SHOP 6 4 6 cash + 0,00 € 1,80 € 1 1,8

1,80 € Non 0,00 €
180828 thierry 11/03/2009 07:17:08 90162909 RED BULL SHOP 6 4 6 cash + 0,00 € 1,80 € 1 1,8

1,80 € Non 0,00 €
180828 thierry 11/03/2009 07:17:10 600 pain PAIN 34 6 cash + 0,00 € 1,75 € 1 1,75

1,75 € Non 0,00 €
180828 thierry 11/03/2009 07:17:15 3258171933109 GAULOISES BL 29 CIGARETTES 1 0 cash + 0,00 € 5,80 € 1 5,8

5,80 € Non 0,00 €
180829 thierry 11/03/2009 07:17:45 80310839 TIC TAC LIM ORA SHOP 6 4 6 cash + 0,00 € 0,80 € 1 0,8

0,80 € Non 0,00 €
180831 thierry 11/03/2009 07:23:27 5449000052926 FANTA 1,5 L SHOP 6 4 6 cash + 0,00 € 1,85 € 1 1,85

1,85 € Non 0,00 €
180831 thierry 11/03/2009 07:23:29 54027381 NEXT 20 CIG CIGARETTES 1 0 cash + 0,00 € 3,70 € 1 3,7

3,70 € Non 0,00 €
180832 thierry 11/03/2009 07:25:01 87248869 L&M CIGARETTES 1 0 bancontact + 0,00 € 5,00 € 1 5

5,00 € Non 0,00 €
180832 thierry 11/03/2009 07:25:01 87248869 L&M CIGARETTES 1 0 bancontact + 0,00 € 5,00 € 1 5

5,00 € Non 0,00 €
180833 thierry 11/03/2009 07:28:47 5420018057202 GALETTE PUR BEU SHOP 6 4 6 cash + 0,00 € 0,75 € 1 0,75

0,75 € Non 0,00 €
180833 thierry 11/03/2009 07:28:50 54491472 COCA LIGHTCIT 5 SHOP 6 4 6 cash + 0,00 € 1,35 € 1 1,35

1,35 € Non 0,00 €
180835 thierry 11/03/2009 07:32:23 90162909 RED BULL SHOP 6 4 6 cash + 0,00 € 1,80 € 1 1,8

1,80 € Non 0,00 €
180835 thierry 11/03/2009 07:32:24 90162909 RED BULL SHOP 6 4 6 cash + 0,00 € 1,80 € 1 1,8

1,80 € Non 0,00 €
180835 thierry 11/03/2009 07:32:26 5449000052926 FANTA 1,5 L SHOP 6 4 6 cash + 0,00 € 1,85 € 1 1,85

1,85 € Non 0,00 €
180835 thierry 11/03/2009 07:32:28 54137417 LM BIG PACK CIGARETTES 1 0 cash + 0,00 € 6,00 € 1 6

6,00 € Non 0,00 €
180836 thierry 11/03/2009 07:32:58 54137493 MARLBORO INTENS CIGARETTES 1 0 cash + 0,00 € 4,20 € 1 4,2

4,20 € Non 0,00 €
180836 thierry 11/03/2009 07:32:58 90162909 RED BULL SHOP 6 4 6 cash + 0,00 € 1,80 € 1 1,8

1,80 € Non 0,00 €

Quand je fait mon code il me trouve 2 X le 180824
bonjour si vous avez plus simple pour moi je suis preneur
Mon code me sert a aditionner tout les ticket de même numéro
Merci
jeudi 12 mars 2009 à 10:06:38 | Re : probleme avec acces , sur recherche dans la table

Renfield

Administrateur CodeS-SourceS
la conception de ta table n'est pas top top... (redondance...)

me gène aussi d'avoir n heures differentes pour un même ticket.
jeudi 12 mars 2009 à 10:08:31 | Re : probleme avec acces , sur recherche dans la table

Renfield

Administrateur CodeS-SourceS
toute ta maladroite mécanique peut être faite grace a une requete SQL bien tournée :


SELECT nticket,date,mode_pay,
             SUM(SELECT SUM( TOTAL) FROM Table1 T2 WHERE T1.nticket=T2.nticket AND opa='+') As Plus,
             SUM(SELECT SUM( TOTAL) FROM Table1 T2 WHERE T1.nticket=T2.nticket AND opa='-') AS Moins,
             Plus-Moins As TOTAL
FROM Table1 T1
GROUP BY nticket, date, mode_pay



NB. je n'ai pas demandé ici l'heure, puisque le groupement de données ne fonctionnerait pas.


jeudi 12 mars 2009 à 18:52:02 | Re : probleme avec acces , sur recherche dans la table

petiflamand

Bonjour ,
Je vais tester , je suis nopvice donc je fait par rapport a ce que je connait , pour le ticket c'est normale puisque l'heure est intégré au moment ou on scan l'article

Je teste ce soir
Merci


Cette discussion est classée dans : rs, ticket, shop, thierry, cash


Répondre à ce message

Sujets en rapport avec ce message

pbme base de données urgent [ par flo ] bjrVoila j'ai cree une BD sous ACCES contenant 2 tables dont une s'appelle AlbumJe voudrai faire une requete dessus et j'ai donc le code suivant:Priva Passage de Paramètres VB -> SQL [ par Anne ] J'ai un problème pour le passage de mes parametres de VB vers une PROC STOCK SQLMon paramètre et du type string et peut comporter le caractère "'" pbl de connexion à ma base access [ par seb ] voici mon codePrivate Sub Commande0_Click()Dim db As DatabaseDim rs As RecordsetDim var As StringSet db = CurrentDb()'Instruction SQLvar = "select * f pbl [ par seb ] voici mon codePrivate Sub Commande0_Click()Dim db As DatabaseDim rs As RecordsetDim var As StringSet db = CurrentDb()'Instruction SQLvar = "select * f au secours!!! [ par petitnouveau ] Bonjour à tous,je suis actuellement en formation Conception et développement, et je me retrouve devant VB et je vous avoue avoir beaucoup de mal avec Tracer 3 courbes avec MsChart [ par Krasba ] J'ai un gros probleme, j'ai inserer un Mschart qui recupere les données d'une base de données. Je dois tracer 3 courbes avec. Le probleme c'est qu'il Tables temporaires dans VB6 + SQL Server [ par lolo ] Bonjour,j'ai une appli qui a besoin de tables de travail pour ses calculs, et qui est multi-utilisateurs. J'ai donc pensé aux tables temporaires, mais [?] VBA et RS-232 [?] [ par nours ] Je suis à la recherche d'un moyen de récuperer des données venant de la liaison série (un dynamomètre) dans un classeur excel. Cela est il possible??? RECUPERER 1 DONNEE [ par sweeping ] Dim rs As New ADODB.RecordsetsSQL = "select libelle from adresse where numadr=1 and numpro= " & num & ";"gcmd.CommandText = sSQLSet rs = gcmd.ExecuteE


Nos sponsors


Sondage...

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 : 2,574 sec (4)

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