ZeidHaddad
Registered User.
- Local time
- Yesterday, 23:44
- Joined
- Oct 29, 2019
- Messages
- 44
Good day to you all. I'm having a problem with this code:
I'm Using the code to update my target table "Documentation" i've already used it on another Form and it worked perfectly but when i copied it and used it on another form when i click the save button ( Speichern_Click) I get that the object is not found and txt.name is highlighted although Me.txtName if inside the form and the name is correct as well as Name is inside table dokumentation.
Any help ?
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 & "',Bausparsumme = '" & Me.txtBausparsumme & "',Abschlussdatum = '" & Me.txtAbschlussdatum & "',Saldo_EUR = '" & Me.txtSaldo_EUR & "',Saldo_3112_Vorjahr_EUR = '" & Me.txtSaldo_3112_Vorjahr_EUR & "',Sollzins_Gebunden_Fest_JAEhrlic = '" & Me.TXTSollzins_Gebunden_Fest_JAEhrlic & "',Guthabenszins_Jaehrlich = '" & Me.txtGuthabenszins_Jaehrlich & "',V_Name = '" & Me.txtV_Name & "',Saldo_EUR = '" & Me.txtSaldo_EUR & "',Saldo_3112_Vorjahr_EUR = '" & Me.txtSaldo_3112_Vorjahr_EUR & "',ZK_vorhanden= '" & Me.txtZK_vorhanden & "',Abtretung_vorhanden = '" & Me.txtAbtretung_vorhanden & "' WHERE Vertragsnummer = '" & Me.Vertragsnummer & "'"
DoCmd.RunSQL (StrSQL)
Else
MaxID = DMax("[FallNr]", "Dokumentation")
If Not IsNull(MaxID) Then
Me.FallNr = MaxID + 1
End If
StrSQL = "UPDATE Santander 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 & ""
DoCmd.RunSQL (StrSQL)
End If
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close
DoCmd.Close acForm, "Sant_lists"
speichern_Click_Exit:
Exit Sub
speichern_Click_Err:
MsgBox Error$
Resume speichern_Click_Exit
End Sub
I'm Using the code to update my target table "Documentation" i've already used it on another Form and it worked perfectly but when i copied it and used it on another form when i click the save button ( Speichern_Click) I get that the object is not found and txt.name is highlighted although Me.txtName if inside the form and the name is correct as well as Name is inside table dokumentation.
Any help ?
Last edited by a moderator: