msgbox meldet sich unaufgefordert
18.12.2004 16:16:27
Fritz
Ich hänge mal wieder fest.
Kurz bevor der folgende Code abgearbeitet ist, kommt noch einmal die Msgbox "Buchung".
Warum tut sie mir das an?
Private Sub txtkm_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Meldung As String, pruefung As String
Dim r As Integer
Dim pfad As String
r = Cells(Rows.Count, 1).End(xlUp).Row + 1
Meldung = MsgBox("Soll der Vorgang gebucht werden?", vbYesNo, "Buchung")
If Meldung = vbNo Then
Exit Sub
Else
With Sheets("Daten")
Cells(r, 1) = frmfahrer.txtdatum & frmfahrer.cmbfahrer
Cells(r, 2) = frmfahrer.cmbfahrer
Cells(r, 3) = frmfahrer.cmbtourA
Cells(r, 4) = frmfahrer.cmbtourB
Cells(r, 5) = frmfahrer.cmbtourC
Cells(r, 6) = frmfahrer.txtsonderfahrt
If frmfahrer.txtdatum = "" Then
Cells(r, 7) = ""
Else
Cells(r, 7) = CDate(frmfahrer.txtdatum.Value)
End If
If frmfahrer.txtbeginn = "" Then
Cells(r, 8) = ""
Else
Cells(r, 8) = CDate(frmfahrer.txtbeginn)
End If
If frmfahrer.txtende = "" Then
Cells(r, 9) = ""
Else
Cells(r, 9) = CDate(frmfahrer.txtende)
End If
If frmfahrer.txtarbeitszeit = "" Then
Cells(r, 10) = ""
Else
Cells(r, 10) = CDate(frmfahrer.txtarbeitszeit)
End If
Cells(r, 11).Value = CDbl(Format(frmfahrer.txtkm, "0.00"))
If frmfahrer.txtabwbeginn = "" Then
Cells(r, 12) = ""
Else
Cells(r, 12) = CDate(frmfahrer.txtabwbeginn.Value)
End If
If frmfahrer.txtabwende = "" Then
Cells(r, 13) = ""
Else
Cells(r, 13) = CDate(frmfahrer.txtabwende.Value)
End If
If frmfahrer.opturlaub = True Then
Cells(r, 14).Value = "true"
Else
Cells(r, 14).Value = ""
End If
If frmfahrer.optkrank = True Then
Cells(r, 15).Value = True
Else
Cells(r, 15).Value = ""
End If
If frmfahrer.optfortbildung = True Then
Cells(r, 16).Value = True
Else
Cells(r, 16).Value = ""
End If
If frmfahrer.optsonstabw = True Then
Cells(r, 17).Value = True
Else
Cells(r, 18).Value = ""
End If
End With
End If
pruefung = MsgBox("Datensatz" & vbTab & Cells(r, 1) & Chr(13) & _
"Fahrer" & vbTab & vbTab & Cells(r, 2) & Chr(13) & _
"Tour A" & vbTab & vbTab & Cells(r, 3) & Chr(13) & _
"Tour B" & vbTab & vbTab & Cells(r, 4) & Chr(13) & _
"Tour C" & vbTab & vbTab & Cells(r, 5) & Chr(13) & _
"Sonderfahrt" & vbTab & Cells(r, 6) & Chr(13) & _
"Datum" & vbTab & vbTab & Cells(r, 7) & Chr(13) & _
"Beginn" & vbTab & vbTab & Format(CDate(Cells(r, 8)), "hh:mm") & Chr(13) & _
"Ende" & vbTab & vbTab & Format(CDate(Cells(r, 9)), "hh:mm") & Chr(13) & _
"Arbeitszeit" & vbTab & Format(CDate(Cells(r, 10)), "hh:mm") & Chr(13) & _
"Kilometer" & vbTab & vbTab & Cells(r, 11), vbYesNo, "Überprüfen Sie bitte die Buchung")
If pruefung = vbNo Then
Cells(r, 1).EntireRow.Delete
Exit Sub
Else
frmfahrersaeubern '''MACHT ALLE COMBOBOXES UND TEXTBOXEX LEER
Signal '''NACH ERFOLGTER BUCHUNG GIBT ER DAS SIGNALHORN
End If
frmfahrer.cmbfahrer.SetFocus '''FOKUS WIRD NICHT GESETZT
'''MSGBOX "BUCHUNG" MELDET SICH NOCHMAL
End Sub
Wäre toll, wenn Ihr wieder helfen kööntet.
Fritz