Salve ragazzi ho questo codice per fare l'inserimento dati nel database
Private Sub cmdsalva_Click()
'CONTROLLI PER L'INSERIMENTO CAMPI OBBLIGATORI
If Len(Trim(txtcog.Text)) = 0 Then
MsgBox "Il campo Cognome è obbligatorio", vbInformation
txtcog.SetFocus
ElseIf Len(Trim(txtnom.Text)) = 0 Then
MsgBox "Il campo Cognome è obbligatorio", vbInformation
txtnom.SetFocus
ElseIf Len(Trim(txtrag.Text)) = 0 Then
MsgBox "La ragione sociale è un campo obbligatorio", vbInformation
txtrag.SetFocus
ElseIf Len(Trim(txtind.Text)) = 0 Then
MsgBox "L'indirizzo è un campo obbligatorio", vbInformation
txtind.SetFocus
ElseIf Len(Trim(txtiva.Text)) = 0 Or IsNumeric(txtiva.Text) = False Or Len(Trim(txtiva.Text)) > 11 Or Len(Trim(txtiva.Text)) < 11 Then
MsgBox "Il campo IVA deve essere numerico e di 11 caratteri", vbInformation
txtiva.SetFocus
ElseIf Len(Trim(txttel.Text)) = 0 Or IsNumeric(txttel.Text) = False Then
MsgBox "Il telefono è un campo obbligatorio e numerico", vbInformation
txttel.SetFocus
Else
'apre la connessione al database
ApriConnessione ("INSERT INTO clienti ( nom, cog, ind, rag, ema, iva, tel, tip, zona) VALUES ('" & txtnom.Text & "', '" & txtcog.Text & "', '" & txtind.Text & "', '" & txtrag.Text & "', '" & txtema.Text & "', " & txtiva.Text & "," & txttel.Text & "," & txttip.Text & "," & txtzona.Text & ");")
ChiudiConnessione
'Pulisco i campi
txtnom.Text = ""
txtcog.Text = ""
txtind.Text = ""
txttel.Text = ""
txtiva.Text = ""
txtrag.Text = ""
txttip.Text = ""
txtzona.Text = ""
txtema.Text = ""
End If
End Sub
1) Mi pulisce i campi ma nn mi inserisce nulla nel database![]()
2) Non so come ricaricare la mia combobox con i relativi record inseriti
HELP MEEEEEEEEE![]()

Rispondi quotando