ZeidHaddad
Registered User.
- Local time
- Today, 12:37
- Joined
- Oct 29, 2019
- Messages
- 44
Good day to you all!
so i'm using this code to update my table "Dokumentation" but i noticed that it's not updating the table unless i remove the lines :
"',Anruf_2 = '" & Me.txtAnruf_2 & _
"',Anruf_3 = '" & Me.txtAnruf_3 & _
if the lines are inside the code nothing will update, however if i remove them and press the save button Again it will save with no problems.
Code:
so i'm using this code to update my table "Dokumentation" but i noticed that it's not updating the table unless i remove the lines :
"',Anruf_2 = '" & Me.txtAnruf_2 & _
"',Anruf_3 = '" & Me.txtAnruf_3 & _
if the lines are inside the code nothing will update, however if i remove them and press the save button Again it will save with no problems.
Code:
Code:
Private Sub speichern_Click()
On Error GoTo speichern_Click_Err
On Error Resume Next
Dim MaxID As Variant
Dim StrSQL As String
If Me.Vertragsnummer = DLookup("[Vertragsnummer]", "Dokumentation", "[Vertragsnummer] = '" & Me.Vertragsnummer & "'") Then
MsgBox ("Entry already exists - please save")
StrSQL = "UPDATE Dokumentation SET Name = '" & Me.txtName & _
"',Vorname = '" & Me.txtVorname & _
"',Anruf_1 = '" & Me.txtAnruf_1 & _
"',Anruf_2 = '" & Me.txtAnruf_2 & _
"',Anruf_3 = '" & Me.txtAnruf_3 & _
"',Kunde_erreicht = '" & Me.txtKunde_erreicht & _
"',Anrede = '" & Me.txtAnruf_1 & _
"',Geburtsdatum_KUNDE = '" & Me.txtGeburtsdatum_KUNDE & _
"',TELEFONNR_Kunde = '" & Me.txtTELEFONNR & _
"',E_Mail_Kunde = '" & Me.txtE_Mail & _
"',Bausparsumme = '" & Me.txtBausparsumme & _
"',Abschlussdatum = '" & Me.txtAbschlussdatum & _
"',Saldo_EUR = '" & Me.txtSaldo_EUR & _
"',Saldo_3112_Vorjahr_EUR = '" & Me.txtSaldo_3112_Vorjahr_EUR & _
"',VL_Eingang = '" & Me.txtVL_Eingang & _
"',Sollzins_Gebunden_Fest_JAEhrlic = '" & Me.TXTSollzins_Gebunden_Fest_JAEhrlic & _
"',Tarifgeneration = '" & Me.txtTarifgeneration & _
"',Tarif = '" & Me.txtTarif & _
"',Datum_letzter_Zahlungseingang = '" & Me.txtDatum_Letzter & _
"' WHERE Vertragsnummer = '" & Me.Vertragsnummer & "'"
CurrentDb.Execute StrSQL, dbFailOnError
Else
MaxID = DMax("[FallNr]", "Dokumentation")
If Not IsNull(MaxID) Then
Me.FallNr = MaxID + 1
End If
StrSQL = "UPDATE Eigenerbestand SET Anruf_1 = '" & Me.txtAnruf_1 & "', Anruf_2 = '" & Me.txtAnruf_2 & "', Anruf_3 = '" & Me.txtAnruf_3 & "', Kunde_erreicht = '" & Me.txtKunde_erreicht & "' WHERE Vertragsnummer = " & Me.Vertragsnummer & ""
CurrentDb.Execute StrSQL, dbFailOnError
End If
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close
DoCmd.Close acForm, "Eigenerbestand_lists"
speichern_Click_Exit:
Exit Sub
speichern_Click_Err:
MsgBox Error$
Resume speichern_Click_Exit
End Sub
Last edited: