I would like to update a table and use the code:
Private Sub btnWijzigTekstKorting_Click()
Dim tekst As String
If IsNull(DLookup("tblNummeringDocumenten.TekstKortingBetaling", "tblNummeringDocumenten")) Then
tekst = ""
Else
tekst = DLookup("tblNummeringDocumenten.TekstKortingBetaling", "tblNummeringDocumenten")
End If
gTekstKortingBetaling = InputBox("Geef de tekst", "Ingave tekst")
DoCmd.SetWarnings False
DoCmd.RunSQL "Update tblNummeringDocumenten Set [TekstKortingBetaling] ='" & gTekstKortingBetaling & "'where tblNummeringDocumenten.[TekstKortingBetaling]=' & tekst'"
DoCmd.SetWarnings True
KortingBetalingTekst = gTekstKortingBetaling
End Sub
The table has only one record with default values. The field TekstKortingBetaling is normal Null. If the user would like to change the default value for this field he uses this code with an inputbox etc. I get now error but there is allso now update in the table. What is wrong? Thanks
Private Sub btnWijzigTekstKorting_Click()
Dim tekst As String
If IsNull(DLookup("tblNummeringDocumenten.TekstKortingBetaling", "tblNummeringDocumenten")) Then
tekst = ""
Else
tekst = DLookup("tblNummeringDocumenten.TekstKortingBetaling", "tblNummeringDocumenten")
End If
gTekstKortingBetaling = InputBox("Geef de tekst", "Ingave tekst")
DoCmd.SetWarnings False
DoCmd.RunSQL "Update tblNummeringDocumenten Set [TekstKortingBetaling] ='" & gTekstKortingBetaling & "'where tblNummeringDocumenten.[TekstKortingBetaling]=' & tekst'"
DoCmd.SetWarnings True
KortingBetalingTekst = gTekstKortingBetaling
End Sub
The table has only one record with default values. The field TekstKortingBetaling is normal Null. If the user would like to change the default value for this field he uses this code with an inputbox etc. I get now error but there is allso now update in the table. What is wrong? Thanks