buongiorno.
all'interno di una elenco dal quale devo estrarre dei testi ho la presenza dell'apice...
le caselle interessate sono nell'elenco, [nomefrutto] dove ho il testo con l'apice e la textbox [frutta] la destinazione del testo.
ho provato a creare due variabili prova1 e prova2 ma senza risultato...ho provato in diverse maniere con Replace ma ovunque lo inserisco
non riesco ad ottenere risultati...dove va inserito all'interno di questo codice?...grazie in anticipo....
codice:
Private Sub Comando2_Click()
'Forms![ordine]![elencoordine]![frutta] = Forms![ordine]![elencofrutti]![nomefrutto]
Dim prova1 As String
Dim prova2 As String
prova1 = " '" & Replace([frutta], "'", "''") & "' "
prova2 = " '" & Replace([nomefrutto], "'", "''") & "' "
On Error GoTo errHandler
With Me
If Not .NewRecord Then
DBEngine(0)(0).Execute "insert into sottoordine(id, idfrutto, prova1 , produttore) values (" & Forms!ordine!elencoordine!ID & ",'" & .ID & "','" & .prova2 & "','" & .produttore & "');", &H80
.Parent!elencoordine.Requery
End If
End With
exit_here:
Exit Sub
errHandler:
With Err
Select Case .Number
Case 3022
VBA.MsgBox prompt:="Il frutto che stai tendando di inserire è già presente per questo ordine!", _
buttons:=vbCritical + vbOKOnly, _
title:="Attenzione"
Case Else
VBA.MsgBox "ERR#" & .Number _
& vbNewLine & .Description _
, vbOKOnly Or vbCritical
Resume exit_here
End Select
End With
End Sub