Necesito limpiar los registro del combobox
Al momento de agregar en mi tabla y limpiar todos los registro de la tabla me un error de text es solo de lectura y más que todo es por combobox ya que al momento de limbialo programo de esta forma:
combo1.text = ""
combo2.text = ""
de todas manera te estoy dejando mi codigo para ver si me ayudas
Rem AGREGAR
Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox "EL CAMPO DEPATAMENTO ESTA VACIO", vbInformation
MsgBox "DEBE DE SELECCIONAR UNA OPCCIÓN"
Exit Sub
End If
If Textnuemero_del_activo = "" Then
MsgBox "DEBES COLOCAR EL NUMERO DEL ACTIVO", vbInformation
Exit Sub
End If
If Combo2.Text = "" Then
MsgBox "SE REQUIERE UN TIPO DE ACTIVO", vbInformation
Exit Sub
End If
If Textcodigobarra.Text = "" Then
MsgBox "DEBES PRECIONAR EL BOTON DE GENERA CODIGO PARA POR CONTINUAR", vbInformation
Exit Sub
End If
If TextMarcActivo.Text = "" Then
MsgBox "EL CAMPO MARCA DEL ACTIVO ESTA VACIO", vbInformation
Exit Sub
End If
If TextModeloActivo.Text = "" Then
MsgBox "EL CAMPO MODELO DEL ACTIVO ESTA VACIO", vbInformation
Exit Sub
End If
If TextSerialActivo.Text = "" Then
MsgBox "EL SERIAL DEL ACTIVO ESTA VACIO", vbInformation
Exit Sub
End If
If TextMedidasActivo.Text = "" Then
MsgBox "LAS MEDIDAS ES NECESARIO CUANDO SE REQUIERA", vbInformation
MsgBox "UTILIZA N/A SI NO APLICA"
Exit Sub
End If
Adodc3.Recordset.AddNew
Adodc3.Recordset.Fields("Departamento") = Combo1.Text
Adodc3.Recordset.Fields("IdDepartamento") = Label10.Caption
Adodc3.Recordset.Fields("Piso del Departamento") = Textpiso.Text
Adodc3.Recordset.Fields("Numero del Activo") = Textnuemero_del_activo.Text
Adodc3.Recordset.Fields("NºEtiqueta") = Textcodigobarra.Text
Adodc3.Recordset.Fields("Tipo de Activo") = Combo2.Text
Adodc3.Recordset.Fields("Marca de Activo") = TextMarcActivo.Text
Adodc3.Recordset.Fields("Modelo del Activo") = TextModeloActivo.Text
Adodc3.Recordset.Fields("Serial del activo") = TextSerialActivo.Text
Adodc3.Recordset.Fields("Medidas del Activo") = TextMedidasActivo.Text
Adodc3.Recordset.Fields("Creado por") = Text1.Text
Adodc3.Recordset.Fields("Fecha de creacion") = Date
Adodc3.Recordset.Fields("Hora de la creacion") = Time
Adodc3.Recordset.Update
Textnuemero_del_activo.Text = ""
Textcodigobarra.Text = ""
TextMarcActivo.Text = ""
TextModeloActivo.Text = ""
TextSerialActivo.Text = ""
TextMedidasActivo.Text = ""
MsgBox "DATOS GRABADOS", vbInformation
Rem GRABAR EN TABLA AUDITORIA
Adodc4.Recordset.AddNew
Adodc4.Recordset.Fields("Nombre de Usuario") = Text1.Text
Adodc4.Recordset.Fields("Fecha de Ingreso") = Date
Adodc4.Recordset.Fields("HORA") = Time
Adodc4.Recordset.Fields("ACCION") = "Agrego Activo Nuevo"
Adodc4.Recordset.Update
End Sub
Rem CARGO LOS DEPARTAMENTOS EN EL COMBOBOX
Private Sub Combo1_Click()
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
If Combo1.Text = Adodc1.Recordset.Fields("Nombre del Departamento") Then
Textpiso = Adodc1.Recordset.Fields("Ubicación Piso")
Label10.Caption = Adodc1.Recordset.Fields("IdDepartamento")
Label11.Caption = Adodc1.Recordset.Fields("Ubicación Piso")
End If
Adodc1.Recordset.MoveNext
Loop
End Sub
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
Call cargardepartamentos
Call cargartipoactivo
End Sub
Public Sub cargardepartamentos()
Do While Not Adodc1.Recordset.EOF
Combo1.AddItem Adodc1.Recordset.Fields("Nombre del Departamento")
Adodc1.Recordset.MoveNext
Loop
End Sub
Public Sub cargartipoactivo()
Do While Not Adodc2.Recordset.EOF
Combo2.AddItem Adodc2.Recordset.Fields("Nombre del Activo")
Adodc2.Recordset.MoveNext
Loop
End Sub
combo1.text = ""
combo2.text = ""
de todas manera te estoy dejando mi codigo para ver si me ayudas
Rem AGREGAR
Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox "EL CAMPO DEPATAMENTO ESTA VACIO", vbInformation
MsgBox "DEBE DE SELECCIONAR UNA OPCCIÓN"
Exit Sub
End If
If Textnuemero_del_activo = "" Then
MsgBox "DEBES COLOCAR EL NUMERO DEL ACTIVO", vbInformation
Exit Sub
End If
If Combo2.Text = "" Then
MsgBox "SE REQUIERE UN TIPO DE ACTIVO", vbInformation
Exit Sub
End If
If Textcodigobarra.Text = "" Then
MsgBox "DEBES PRECIONAR EL BOTON DE GENERA CODIGO PARA POR CONTINUAR", vbInformation
Exit Sub
End If
If TextMarcActivo.Text = "" Then
MsgBox "EL CAMPO MARCA DEL ACTIVO ESTA VACIO", vbInformation
Exit Sub
End If
If TextModeloActivo.Text = "" Then
MsgBox "EL CAMPO MODELO DEL ACTIVO ESTA VACIO", vbInformation
Exit Sub
End If
If TextSerialActivo.Text = "" Then
MsgBox "EL SERIAL DEL ACTIVO ESTA VACIO", vbInformation
Exit Sub
End If
If TextMedidasActivo.Text = "" Then
MsgBox "LAS MEDIDAS ES NECESARIO CUANDO SE REQUIERA", vbInformation
MsgBox "UTILIZA N/A SI NO APLICA"
Exit Sub
End If
Adodc3.Recordset.AddNew
Adodc3.Recordset.Fields("Departamento") = Combo1.Text
Adodc3.Recordset.Fields("IdDepartamento") = Label10.Caption
Adodc3.Recordset.Fields("Piso del Departamento") = Textpiso.Text
Adodc3.Recordset.Fields("Numero del Activo") = Textnuemero_del_activo.Text
Adodc3.Recordset.Fields("NºEtiqueta") = Textcodigobarra.Text
Adodc3.Recordset.Fields("Tipo de Activo") = Combo2.Text
Adodc3.Recordset.Fields("Marca de Activo") = TextMarcActivo.Text
Adodc3.Recordset.Fields("Modelo del Activo") = TextModeloActivo.Text
Adodc3.Recordset.Fields("Serial del activo") = TextSerialActivo.Text
Adodc3.Recordset.Fields("Medidas del Activo") = TextMedidasActivo.Text
Adodc3.Recordset.Fields("Creado por") = Text1.Text
Adodc3.Recordset.Fields("Fecha de creacion") = Date
Adodc3.Recordset.Fields("Hora de la creacion") = Time
Adodc3.Recordset.Update
Textnuemero_del_activo.Text = ""
Textcodigobarra.Text = ""
TextMarcActivo.Text = ""
TextModeloActivo.Text = ""
TextSerialActivo.Text = ""
TextMedidasActivo.Text = ""
MsgBox "DATOS GRABADOS", vbInformation
Rem GRABAR EN TABLA AUDITORIA
Adodc4.Recordset.AddNew
Adodc4.Recordset.Fields("Nombre de Usuario") = Text1.Text
Adodc4.Recordset.Fields("Fecha de Ingreso") = Date
Adodc4.Recordset.Fields("HORA") = Time
Adodc4.Recordset.Fields("ACCION") = "Agrego Activo Nuevo"
Adodc4.Recordset.Update
End Sub
Rem CARGO LOS DEPARTAMENTOS EN EL COMBOBOX
Private Sub Combo1_Click()
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
If Combo1.Text = Adodc1.Recordset.Fields("Nombre del Departamento") Then
Textpiso = Adodc1.Recordset.Fields("Ubicación Piso")
Label10.Caption = Adodc1.Recordset.Fields("IdDepartamento")
Label11.Caption = Adodc1.Recordset.Fields("Ubicación Piso")
End If
Adodc1.Recordset.MoveNext
Loop
End Sub
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
Call cargardepartamentos
Call cargartipoactivo
End Sub
Public Sub cargardepartamentos()
Do While Not Adodc1.Recordset.EOF
Combo1.AddItem Adodc1.Recordset.Fields("Nombre del Departamento")
Adodc1.Recordset.MoveNext
Loop
End Sub
Public Sub cargartipoactivo()
Do While Not Adodc2.Recordset.EOF
Combo2.AddItem Adodc2.Recordset.Fields("Nombre del Activo")
Adodc2.Recordset.MoveNext
Loop
End Sub
1 respuesta
Respuesta de asderpunk
1