Computerhilfen.de Logo
Forum
Tipps
News

    If rsShip.RecordCount > 2 Then
              sfmTourListeKosten.Requery
              Set rsShip = sfmTourListeKosten.Form.RecordsetClone
                  strCriteria = "LStNr=" & Me.txtLstNr3
                  rsShip.Find strCriteria, , adSearchForward, 1
                  strCriteria = "ShipNr <> " & varShipNr2
                  rsShip.Find strCriteria, , adSearchForward, 0
             If Not rsShip.EOF Then ' Datensatz suchen
              'Werte bei  LStNr3 eintragen
              varLfdShNr = rsShip!LfdShipNr
              rsShip!TrBeNr = Me!TrBeNr
              varTrBeNr = rsShip!TrBeNr
              rsShip!StGeDC = 0
              StDc = rsShip!StGeDC
              StLs = Me!txtStGeLSt3
              varStLs = Replace(StLs, ",", ".")
              rsShip!StGeLSt = varStLs
              rsShip!TrKosten = Me!TrKosten / Plts * rsShip!TotPlts
              Kost = rsShip!TrKosten
              varKosten = Replace(Kost, ",", ".")
              rsShip!Diesel = Me!Diesel / Plts * rsShip!TotPlts
              Diesel = rsShip!Diesel
              varDiesel = Replace(Diesel, ",", ".")
              rsShip!Maut = Me!Maut / Plts * rsShip!TotPlts
              varMaut = Replace(rsShip!Maut, ",", ".")
              rsShip!UnbudgeKosten = Me.NoBudget / Plts * rsShip!TotPlts
              NoBudget = rsShip!UnbudgeKosten
              varNoBudget = Replace(NoBudget, ",", ".")
              sql = "Insert into tblTrKosten(LfdShipNr,TrBeNr,StGeDC,StGeLSt,TrKosten,Diesel,Maut,UnbudgeKosten) Values " & _
                    "(" & varLfdShNr & "," & varTrBeNr & _
                    "," & StDc & "," & varStLs & "," & varKosten & "," & varDiesel & "," & varMaut & "," & varNoBudget & " ) "
              cn.Execute sql
             End If
           End If
        If rsShip.RecordCount > 3 Then
           sfmTourListeKosten.Requery
           Set rsShip = sfmTourListeKosten.Form.RecordsetClone
           strCriteria = "LStNr= " & Me.txtLstNr4
           rsShip.Find strCriteria, , adSearchForward, 1
          If Not rsShip.EOF Then ' Datensatz suchen
              'Werte bei  LStNr4 eintragen
                varLfdShNr = rsShip!LfdShipNr
                rsShip!TrBeNr = Me!TrBeNr
                varTrBeNr = rsShip!TrBeNr
                rsShip!StGeDC = 0
                StDc = rsShip!StGeDC
                StLs = Me!txtStGeLSt4
                varStLs = Replace(StLs, ",", ".")
                rsShip!StGeLSt = varStLs
                rsShip!TrKosten = Me!TrKosten / Plts * rsShip!TotPlts
                Kost = rsShip!TrKosten
                varKosten = Replace(Kost, ",", ".")
                rsShip!Diesel = Me!Diesel / Plts * rsShip!TotPlts
                Diesel = rsShip!Diesel
                varDiesel = Replace(Diesel, ",", ".")
                rsShip!Maut = Me!Maut / Plts * rsShip!TotPlts
                varMaut = Replace(rsShip!Maut, ",", ".")
                rsShip!UnbudgeKosten = Me.NoBudget / Plts * rsShip!TotPlts
                NoBudget = rsShip!UnbudgeKosten
                varNoBudget = Replace(NoBudget, ",", ".")
                sql = "Insert into tblTrKosten(LfdShipNr,TrBeNr,StGeDC,StGeLSt,TrKosten,Diesel,Maut,UnbudgeKosten) Values " & _
                      "(" & varLfdShNr & "," & varTrBeNr & _
                      "," & StDc & "," & varStLs & "," & varKosten & "," & varDiesel & "," & varMaut & "," & varNoBudget & " ) "
                cn.Execute sql
          End If
        End If
     
Else      'Kosten pro Shipment nach Anzahl der Shipments errechnen
        varLfdShNr = rsShip!LfdShipNr
        rsShip!TrBeNr = Me!TrBeNr
        varTrBeNr = rsShip!TrBeNr
        rsShip!StGeDC = Me!StGeDC
        StDc = rsShip!StGeDC
        varStDC = Replace(StDc, ",", ".")
        rsShip!StGeLSt = Me!StGeLSt
        StLs = rsShip!StGeLSt
        varStLs = Replace(StLs, ",", ".")
        rsShip!TrKosten = Me!TrKosten / AnzRs
        Kost = rsShip!TrKosten
        varKosten = Replace(Kost, ",", ".")
        rsShip!Diesel = Me!Diesel / AnzRs
        Diesel = rsShip!Diesel
        varDiesel = Replace(Diesel, ",", ".")
        rsShip!Maut = Me!Maut / AnzRs
        Maut = rsShip!Maut
        varMaut = Replace(Maut, ",", ".")
        rsShip!UnbudgeKosten = Me.NoBudget / AnzRs
        NoBudget = rsShip!UnbudgeKosten
        varNoBudget = Replace(NoBudget, ",", ".")
        sql = "Insert into tblTrKosten(LfdShipNr,TrBeNr,StGeDC,StGeLSt,TrKosten,Diesel,Maut,UnbudgeKosten) Values " & _
              "(" & varLfdShNr & "," & varTrBeNr & _
              "," & varStDC & "," & varStLs & "," & varKosten & "," & varDiesel & "," & varMaut & "," & varNoBudget & ")"
        cn.Execute sql
   
        'Die Werte für den Datensatz ohne Standgeld übergeben
    If rsShip.RecordCount > 1 Then
       sfmTourListeKosten.Requery
       Set rsShip = sfmTourListeKosten.Form.RecordsetClone
           strCriteria = "ShipNr <> " & varShipNr
           rsShip.Find strCriteria, , adSearchForward, 1
      If Not rsShip.EOF Then ' Datensatz suchen
        'Werte bei ungleicher Shipmentnummer eintragen
         varLfdShNr = rsShip!LfdShipNr
         rsShip!TrBeNr = Me!TrBeNr
         varTrBeNr = rsShip!TrBeNr
         rsShip!StGeDC = 0
         StDc = rsShip!StGeDC
         StLs = Me!txtStGeLSt2
         varStLs = Replace(StLs, ",", ".")
         rsShip!StGeLSt = varStLs
         rsShip!TrKosten = Me!TrKosten / AnzRs
         Kost = rsShip!TrKosten
         varKosten = Replace(Kost, ",", ".")
         rsShip!Diesel = Me!Diesel / AnzRs
         Diesel = rsShip!Diesel
         varDiesel = Replace(Diesel, ",", ".")
         rsShip!Maut = Me!Maut / AnzRs
         varMaut = Replace(rsShip!Maut, ",", ".")
         rsShip!UnbudgeKosten = Me.NoBudget / AnzRs
         NoBudget = rsShip!UnbudgeKosten
         varNoBudget = Replace(NoBudget, ",", ".")
         sql = "Insert into tblTrKosten(LfdShipNr,TrBeNr,StGeDC,StGeLSt,TrKosten,Diesel,Maut,UnbudgeKosten) Values " & _
               "(" & varLfdShNr & "," & varTrBeNr & _
               "," & StDc & "," & varStLs & "," & varKosten & "," & varDiesel & "," & varMaut & "," & varNoBudget & " ) "
         cn.Execute sql
      End If
    End If
     If rsShip.RecordCount > 2 Then
        sfmTourListeKosten.Requery
     Set rsShip = sfmTourListeKosten.Form.RecordsetClone
         strCriteria = "LStNr <> " & Me.txtLstNr3
         rsShip.Find strCriteria, , adSearchForward, 1
       If Not rsShip.EOF Then ' Datensatz suchen

       'Werte bei  LStNr3 eintragen
         varLfdShNr = rsShip!LfdShipNr
         rsShip!TrBeNr = Me!TrBeNr
         varTrBeNr = rsShip!TrBeNr
         rsShip!StGeDC = 0
         StDc = rsShip!StGeDC
         StLs = Me!txtStGeLSt3
         varStLs = Replace(StLs, ",", ".")
         rsShip!StGeLSt = varStLs
         rsShip!TrKosten = Me!TrKosten / AnzRs
         Kost = rsShip!TrKosten
         varKosten = Replace(Kost, ",", ".")
         rsShip!Diesel = Me!Diesel / AnzRs
         Diesel = rsShip!Diesel
         varDiesel = Replace(Diesel, ",", ".")
         rsShip!Maut = Me!Maut / AnzRs
         varMaut = Replace(rsShip!Maut, ",", ".")
         rsShip!UnbudgeKosten = Me.NoBudget / AnzRs
         NoBudget = rsShip!UnbudgeKosten
         varNoBudget = Replace(NoBudget, ",", ".")
         sql = "Insert into tblTrKosten(LfdShipNr,TrBeNr,StGeDC,StGeLSt,TrKosten,Diesel,Maut,UnbudgeKosten) Values " & _
               "(" & varLfdShNr & "," & varTrBeNr & _
               "," & StDc & "," & varStLs & "," & varKosten & "," & varDiesel & "," & varMaut & "," & varNoBudget & " ) "
         cn.Execute sql
       End If
     End If
     If rsShip.RecordCount > 3 Then
        sfmTourListeKosten.Requery
        Set rsShip = sfmTourListeKosten.Form.RecordsetClone
        strCriteria = "LStNr= " & Me.txtLstNr4
        rsShip.Find strCriteria, , adSearchForward, 1
       If Not rsShip.EOF Then ' Datensatz suchen
       
       'Werte bei  LStNr4 eintragen
         varLfdShNr = rsShip!LfdShipNr
         rsShip!TrBeNr = Me!TrBeNr
         varTrBeNr = rsShip!TrBeNr
         rsShip!StGeDC = 0
         StDc = rsShip!StGeDC
         StLs = Me!txtStGeLSt4
         varStLs = Replace(StLs, ",", ".")
         rsShip!StGeLSt = varStLs
         rsShip!TrKosten = Me!TrKosten / Plts * rsShip!TotPlts
         Kost = rsShip!TrKosten
         varKosten = Replace(Kost, ",", ".")
         rsShip!Diesel = Me!Diesel / Plts * rsShip!TotPlts
         Diesel = rsShip!Diesel
         varDiesel = Replace(Diesel, ",", ".")
         rsShip!Maut = Me!Maut / Plts * rsShip!TotPlts
         varMaut = Replace(rsShip!Maut, ",", ".")
         rsShip!UnbudgeKosten = Me.NoBudget / Plts * rsShip!TotPlts
         NoBudget = rsShip!UnbudgeKosten
         varNoBudget = Replace(NoBudget, ",", ".")
         sql = "Insert into tblTrKosten(LfdShipNr,TrBeNr,StGeDC,StGeLSt,TrKosten,Diesel,Maut,UnbudgeKosten) Values " & _
               "(" & varLfdShNr & "," & varTrBeNr & _
               "," & StDc & "," & varStLs & "," & varKosten & "," & varDiesel & "," & varMaut & "," & varNoBudget & " ) "
         cn.Execute sql
       End If
     End If
   
'Daten neu abfragen und Schließen-Button einschalten
  sfmTourListeKosten.Requery
'  cmdCloseForm.Enabled = True
End If
End Function

Hallo!

Donnerwetter! Wir sind beeindruckt. Unser Studiengang: BWL! Unsere Profs stehen aber auf Info und so müssen wir alle extrem beißen.

Mal sehen, ob uns das was hilft.

LG

Und du bist sicher dass du das jetzt mal eben so verstehst wo du vorher 0 Peilung hattest ? Hmmmmmm :-)

Da kriegste ja nen Buchstabenkoller bei den Vars.. ;D

Nö geht.
@Martina: Das ist nen VB-Code, hat nichts mit C zu tun.
Ihr habt doch sicherlich ein Blatt mit C-Konventionen bekommen, nimm das zur Hand, dann meinen ersten und zweiten Vorschlag und den Explizit in C umsetzen (nicht den VB-Code, der ist eh nur nen Beispiel).
Dafür brauchst du: 1. und 2. Beitrag von mir, das Konventionen-Blatt, einen C-Compiler z.B. Borland und etwas Zeit.
Das ganze sieht dann so aus:
1. Programm Deklaration
2. Variablen festlegen (sind schon genannt worden)
3. Datei aufrufen
4. Variablen mit Werten füllen
5. Die Schleife mit den Berechnungen
6. Berechnung des Durchschnitts und Ausgabe der ermittelten Werte.
Programmende
Mehr ist da nicht zu tun.
C-Deklarationen kann man auch bei Google finden (für den unwahrscheinlichen Fall das Ihr sie nicht bekommen habt).

Meine Güte, das ist kein VB-Code, das ist Kauderwelsch!


« Setiosflags und setprecission Java Programm Labyrinth »
 

Schnelle Hilfe: Hier nach ähnlichen Fragen und passenden Tipps suchen!