Hola!
Para guardar datos, lo mejor es usar SQL:
Código vb:
Ver originalPrivate Sub cmdAgregar_Click()
Dim strInsert As String
Dim Ins As Integer
strInsert = "INSERT INTO TABLA (CAMPO1, CAMPO2) VALUES (" & VALOR_NUMERO & ",'" & VALOR_ALFA & "')"
cn.Execute strInsert, Ins
If Ins = 1 Then MsgBox "Registro guardado!!", vbInformation
If (cmdAgregar.Caption = "Guardar") Then
Adodc1.Refresh
Adodc1.Recordset.MoveLast
cmdAgregar.Caption = "Agregar"
Maskhoraini.Visible = False
Maskhorafin.Visible = False
combohab.Visible = False
cmdModificar.Enabled = True
cmdEliminar.Enabled = True
Else
cmdAgregar.Caption = "Guardar"
Maskhoraini.Enabled = True
Maskhorafin.Enabled = True
combohab.Enabled = True
Maskhoraini.Visible = True
Maskhorafin.Visible = True
combohab.Visible = True
Maskhoraini.SetFocus
cmdModificar.Enabled = False
cmdEliminar.Enabled = False
End If
Exit Sub
cn.Close
'Limpio máscaras
Maskhoraini.Mask = ""
Maskhoraini.Text = ""
Maskhorafin.Mask = ""
Maskhorafin.Text = ""
Maskhoraini.Mask = "##:##"
Maskhorafin.Mask = "##:##"
End Sub