Scarlet_Pimp
New member
- Local time
- Today, 04:20
- Joined
- Aug 6, 2025
- Messages
- 7
I have following code that gives me error 3464 "type mismatch criteria".
dubbel = "Bestelbon = " & Me.txtBestelbonNew.Value
The value in the textbox is saved as short text in the table. I've tried to put in in single quotes, double quotes. But nothing seems to work.
Any help would be greatly appreciated!
I am certain it has the do with this line,Code:Private Sub cmdSaveFrm1_Click() Dim db As DAO.Database Dim rs As DAO.Recordset 'Dim sql As String Dim dubbel As String 'eerst een check of het zoekveld niet leeg is If Nz(Me.txtBestelbonNew.Value, "") = "" Then MsgBox "Geef een bestelbon in !!", vbExclamation Exit Sub Else 'sql = "SELECT [Planning]" dubbel = "Bestelbon = " & Me.txtBestelbonNew.Value Set db = CurrentDb Set rs = db.OpenRecordset("Planning", dbOpenDynaset, dbSeeChanges) 'Set rs = db.OpenRecordset(sql, dbOpenDynaset, dbSeeChanges, dbLockOptimistic) rs.FindFirst dubbel 'dan een check dat de bestelbonnummer al niet bestaat If rs.NoMatch Then rs.AddNew rs.Fields("Bestelbon") = txtBestelbonNew.Value rs.Fields("Productcode") = txtProductcodeNew.Value rs.Fields("Hoeveelheid") = txtHoeveelheidNew.Value rs.Fields("Leveringsdatum") = txtLeveringsdatumNew.Value rs.Fields("Opmerkingen") = txtOpmerkingenNew.Value rs.Update rs.Close Else Beep MsgBox "Bestelbon bestaat al !!", vbCritical rs.Close End If End If Set rs = Nothing Set db = Nothing End Sub
dubbel = "Bestelbon = " & Me.txtBestelbonNew.Value
The value in the textbox is saved as short text in the table. I've tried to put in in single quotes, double quotes. But nothing seems to work.
Any help would be greatly appreciated!