adaptar codigo ado a dao
Publicado por armaggedon (13 intervenciones) el 05/05/2007 14:12:23
alguien me puede ayudar a adaptar este codigo a dao??? gracias
Private Sub Form_Load()
Connex.CursorLocation = adUseClient
Connex.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=Base.mdb;Persist Security Info=False"
' & ";" & "Jet OLEDB:Database Password=CONTRASEÑA" ' Si quieres ponerla
With rsClie
If .State Then .Close
.Open "SELECT * FROM Tabla Order by Nombre", Connex, adOpenStatic, adLockOptimistic
If .RecordCount Then VerGridClie
End With
End Sub
Private Sub Form_Resize()
txtclie.SetFocus
End Sub
Private Sub txtclie_GotFocus()
txtclie.SelStart = 0
txtclie.SelLength = Len(txtclie)
End Sub
Private Sub txtclie_Change()
On Local Error Resume Next
With rsClie
If .State Then .Close
.Open "Select * From tabla Where Nombre like '%" & txtclie.Text & "%' Order by Nombre", Connex, adOpenStatic, adLockOptimistic
If .RecordCount = 0 Then
MsgBox ("Parece existir un carácter erróneo" & Chr(10) & _
"en el nombre de este cliente.")
txtclie = Left(txtclie, Len(txtclie) - 1)
Exit Sub
End If
End With
VerGridClie
DoEvents
txtclie.SetFocus
End Sub
Private Sub VerGridClie()
With DGClie
.Visible = True
Set .DataSource = rsClie
.Refresh
.Caption = "LISTADO DE CLIENTES"
.AllowUpdate = False
.Splits(0).AllowRowSizing = False
End With
End Sub
Private Sub DGClie_DblClick()
Form2.Text1.Text = DGClie.Columns(1).Text
End Sub
Private Sub Command1_Click()
Form2.Show vbModal
End Sub
Private Sub Form_Load()
Connex.CursorLocation = adUseClient
Connex.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=Base.mdb;Persist Security Info=False"
' & ";" & "Jet OLEDB:Database Password=CONTRASEÑA" ' Si quieres ponerla
With rsClie
If .State Then .Close
.Open "SELECT * FROM Tabla Order by Nombre", Connex, adOpenStatic, adLockOptimistic
If .RecordCount Then VerGridClie
End With
End Sub
Private Sub Form_Resize()
txtclie.SetFocus
End Sub
Private Sub txtclie_GotFocus()
txtclie.SelStart = 0
txtclie.SelLength = Len(txtclie)
End Sub
Private Sub txtclie_Change()
On Local Error Resume Next
With rsClie
If .State Then .Close
.Open "Select * From tabla Where Nombre like '%" & txtclie.Text & "%' Order by Nombre", Connex, adOpenStatic, adLockOptimistic
If .RecordCount = 0 Then
MsgBox ("Parece existir un carácter erróneo" & Chr(10) & _
"en el nombre de este cliente.")
txtclie = Left(txtclie, Len(txtclie) - 1)
Exit Sub
End If
End With
VerGridClie
DoEvents
txtclie.SetFocus
End Sub
Private Sub VerGridClie()
With DGClie
.Visible = True
Set .DataSource = rsClie
.Refresh
.Caption = "LISTADO DE CLIENTES"
.AllowUpdate = False
.Splits(0).AllowRowSizing = False
End With
End Sub
Private Sub DGClie_DblClick()
Form2.Text1.Text = DGClie.Columns(1).Text
End Sub
Private Sub Command1_Click()
Form2.Show vbModal
End Sub
Valora esta pregunta


0