Ho inserito tutto in un nuovo pulsante.
Non dovrei mettere i campi Ambulatorio-Data-Orario perché non devono essere aggiornati, ma comunque devono far parte della query.
Ho incluso i campi Data Orario
Dim sTabella As String
If VerificaCampi = False Then Exit Sub
sTabella = "Diario"
sSQL = " UPDATE " & sTabella & " SET"
sSQL = sSQL & " Visita = @Visita"
sSQL = sSQL & " ,tVisita=@tVisita"
sSQL = sSQL & " ,Data = @Data"
sSQL = sSQL & " ,Orario = @Orario"
sSQL = sSQL & " ,Cognome= @Cognome"
sSQL = sSQL & " ,Nome = @Nome"
sSQL = sSQL & " ,Sesso = @Sesso"
sSQL = sSQL & " ,Nota=@Nota"
sSQL = sSQL & " ,Telefono = @Telefono"
sSQL = sSQL & " ,CodiceEs = @CodiceEs"
sSQL = sSQL & " ,Terapia=@Terapia"
sSQL = sSQL & " ,Comune=@Comune"
sSQL = sSQL & " WHERE Ambulatorio=" & Val(lblAmbulatorio.Caption)
sSQL = sSQL & " And Data = #" & Format(txtData.Text, "MM/dd/yyyy") & "#"
sSQL = sSQL & " And Orario = #" & txtTime.Text & "#"
Set cmd = New ADODB.Command
With cmd
.ActiveConnection = cn
.CommandType = adCmdText
.CommandText = sSQL
SetADOParameter cmd, sTabella, "Visita", "A"
SetADOParameter cmd, sTabella, "tVisita", cboTVisita.Text
SetADOParameter cmd, sTabella, "Data", txtData.Text
SetADOParameter cmd, sTabella, "Orario", CDate(txtTime.Text)
SetADOParameter cmd, sTabella, "Cognome", txtCognome.Text
SetADOParameter cmd, sTabella, "Nome", txtNome.Text
SetADOParameter cmd, sTabella, "Sesso", txtSesso.Text
SetADOParameter cmd, sTabella, "Nota", txtNote.Text
SetADOParameter cmd, sTabella, "Telefono", txtTelefono.Text
SetADOParameter cmd, sTabella, "CodiceEs", txtCodiceEs.Text
SetADOParameter cmd, sTabella, "Terapia", cboTerapie.Text
SetADOParameter cmd, sTabella, "Comune", txtComune.Text
cmd.Execute
End With
MsgBox "Dati Aggiornati!", vbExclamation, Me.Caption
Niente..
escludendo i campi Data e Orario
Dim sTabella As String
If VerificaCampi = False Then Exit Sub
sTabella = "Diario"
sSQL = " UPDATE " & sTabella & " SET"
sSQL = sSQL & " Visita = @Visita"
sSQL = sSQL & " ,tVisita=@tVisita"
'sSQL = sSQL & " ,Orario = @Orario"
sSQL = sSQL & " ,Cognome= @Cognome"
sSQL = sSQL & " ,Nome = @Nome"
sSQL = sSQL & " ,Sesso = @Sesso"
sSQL = sSQL & " ,Nota=@Nota"
sSQL = sSQL & " ,Telefono = @Telefono"
sSQL = sSQL & " ,CodiceEs = @CodiceEs"
sSQL = sSQL & " ,Terapia=@Terapia"
sSQL = sSQL & " ,Comune=@Comune"
sSQL = sSQL & " WHERE Ambulatorio=" & Val(lblAmbulatorio.Caption)
sSQL = sSQL & " And Data = #" & Format(txtData.Text, "MM/dd/yyyy") & "#"
sSQL = sSQL & " And Orario = #" & CDate(txtTime.Text) & "#"
Set cmd = New ADODB.Command
With cmd
.ActiveConnection = cn
.CommandType = adCmdText
.CommandText = sSQL
SetADOParameter cmd, sTabella, "Visita", "A"
SetADOParameter cmd, sTabella, "tVisita", cboTVisita.Text
SetADOParameter cmd, sTabella, "Cognome", txtCognome.Text
SetADOParameter cmd, sTabella, "Nome", txtNome.Text
SetADOParameter cmd, sTabella, "Sesso", txtSesso.Text
SetADOParameter cmd, sTabella, "Nota", txtNote.Text
SetADOParameter cmd, sTabella, "Telefono", txtTelefono.Text
SetADOParameter cmd, sTabella, "CodiceEs", txtCodiceEs.Text
SetADOParameter cmd, sTabella, "Terapia", cboTerapie.Text
SetADOParameter cmd, sTabella, "Comune", txtComune.Text
cmd.Execute
End With
MsgBox "Dati Aggiornati!", vbExclamation, Me.Caption
nada...
Sicuramente sbaglio o ometto qualcosa, ma non riesco a venirne a capo anche perché non mi dà nessun errore.
Grazie