RE:ayuda con código en acces
Public RST_EMPLEADO As New Recordset
Public RST_NIVEL As New Recordset
Public ADOCONN As New ADODB.Connection 'CONEXION*************
Public Function conex()
On Error Resume Next
ADOCONN.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=" + App.Path + "\VAL.mdb"
ADOCONN.Open
If Err.Number Then
MsgBox "Se ha producido el siguiente error:" & vbCrLf & _
Err.Number & ", " & Err.Description
End
End If
End Function
Public Function desconectar()
ADOCONN.Close
End Function
'entradad de registros desde text
Call conex
RST_EMPLEADO.Source = "INSERT INTO TB_CON VALUES('" & TXT_NOM.Text & "','" & TXT_NACIO.Text & "','" & TXT_EDAD.Text & "','" & TXT_EDOCIVIL.Text & "','" & TXT_DOMI.Text & "','" & TXT_PUESTO.Text & "'," & TXT_SALARIO.Text & "," & TXT_POR.Text & "," & TXT_VAC.Text & "," & TXT_ASIG.Text & ",'" & Combo1.Text & "','" & Combo2.Text & "' ,'" & DTPicker1.Value & "','" & TXT_GT.Text & "','" & Combo3.Text & "' , '" & Combo4.Text & "'," & TXT_CVL_EMP.Text & ")"
RST_EMPLEADO.ActiveConnection = ADOCONN
MsgBox "REGISTRO ALMACENADO", vbInformation
RST_EMPLEADO.Open
desconectar
'actualizacion
conex
RST_NIVEL.Source = "Update tb_CON set nombre_COMPLETO = '" & Txt_Nombre.Text & "',s_diario =" & cosa2 & ", curp ='" & Txt_Curp.Text & "',RFC='" & Txt_Rfc.Text & "',cvl_nivel=" & CVL_N & ",cvl_seccion=" & CVL_S & ",puesto='" & Cbo_Puesto.Text & "',tS=" & cosa & " WHERE cvl_empleado ='" & txt_AcEm.Text & "'"
RST_NIVEL.ActiveConnection = ADOCONN
RST_NIVEL.Open
MsgBox ("El registro se a modificado"), vbInformation
desconectar
'eliminacion
conex
RST_EMPLEADO.Source = "delete from tb_CON where cvl_emp=(" & TXT_CVL_EMP.Text & ")"
RST_EMPLEADO.ActiveConnection = ADOCONN
RST_EMPLEADO.Open
desconectar
MsgBox ("el registro se a eliminado"), vbCritical, "REGISTRO ELIMINADO"