Option Explicit

Fecha: el 4 de Febrero
Categoria: General
Descargas: 0
Descripción:
Resumen (Extraido del documento):
Option Explicit
Const cadena = "provider=microsoft.jet.oledb.4.0;data source=agenda2.mdb"
Dim cnn As ADODB.Connection
Dim rscomand As ADODB.Command
Private Sub cmdbuscar_Click()
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim comand As ADODB.Command
Dim x, strsql As String

Set rs = New ADODB.Recordset


If cmdbuscar.Value = True Then

x = InputBox("introduce el nombre a buscar", "ingresar el nombre")
If x <> "" Then
Dim intreg
Set cnn = New ADODB.Connection
cnn.Open cadena
Set comand = New ADODB.Command
Set comand.ActiveConnection = cnn
comand.CommandText = "select * from tabla0 where nombre like '" + x + "'"
comand.CommandType = adCmdText

comand.Execute intreg

If intreg = 1 Then
MsgBox "se encontro el registro", vbInformation + vbOKOnly, "comando"
Else
MsgBox "el registro no se encontro", vbInformation + vbOKOnly, "comando"
End If
cnn.Close
Set cnn = Nothing
End if
End if
End sub
Private Sub cmdguardar_Click()
Dim intreg

Set cnn = New ADODB.Connection

cnn.Open cadena
Set rscomand = New ADODB.Command

Set rscomand.ActiveConnection = cnn
If txtnombre.Text = "" Or _
txtcalle.Text = "" Then
MsgBox "datos incompletos", vbCritical, "error"
Exit Sub
End If

rscomand.CommandText = "insert into tabla0(nombres,calles)values('" & txtnombre.Text & "','" & txtcalle.Text & "')"
rscomand.CommandType = adCmdText


rscomand.Execute intreg


If intreg = 1 Then
MsgBox "se grebo el registro", vbInformation + vbOKOnly, "comando"

Else
MsgBox "el registro no se grabo", vbInformation + vbOKOnly, "coamndo"
End If
cnn.Close
Set cnn = Nothing

End Sub
Ademas me sale un error k dic “variable de tipo object o la variable
compartir

Sé el primero en opinar


 
Páginas internacionales: España  |  Italia  |  Francia  |  México  |  Alemania  |  Reino Unido  |  Argentina  |  Chile  |  Colombia  |  USA

Búsquedas frecuentes: circuito 9/12 tratamiento para celotipia como dejar de ser celoso me duele el pecho manualidades con papel reciclado

Emagister cumple la Ley Orgánica 15/1999 de 13 de diciembre, de Protección de datos de Carácter Personal, y posee el código de inscripción nº 2002010053 del Registro General de la Agencia de Protección de Datos. Copyright © 1999/2000 - Grupo Intercom - Todos los derechos