Visual Basic - COMO BUSCAR UN REGISTRO

Life is soft - evento anual de software empresarial
 
Vista:

COMO BUSCAR UN REGISTRO

Publicado por hilario (100 intervenciones) el 13/01/2005 17:04:33
HOLA,
DESEO SABER COMO LOCALIZAR UN REGISTRO EN UNA TABLA SIN EL USO DEL CONTROL DATA. ES DECIR, COMO PUEDO UTILIZAR EL COMANDO FindFirst SIN NECESIDAD DE INCLUIR EL CONTROL DATA EN EL FORMULARIO.

GRACIAS
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:COMO BUSCAR UN REGISTRO

Publicado por miguel (1042 intervenciones) el 13/01/2005 18:02:31
Prueba con esto, utilizo conexion DAO:
Dim mibase As Database
Dim miregistro As Recordset
Dim sql As String

Sub Busqueda()
Set mibase = OpenDatabase("c:\Mantenimiento\Materiales.mdb")
sql = "Select * From CatAreas"
Set miregistro = mibase.OpenRecordset(sql, dbOpenSnapshot)

strDepto = "SISTEMAS"
strBusqueda = "Area = '" & strDepto & "'" 'Nombre del Campo y tu Dato a Buscar

miregistro.FindFirst strBusqueda

If miregistro.NoMatch Then
MsgBox "No Existe el Departamento", vbInformation, "Busqueda"
Else
MsgBox "Si Existe el Departamento", vbInformation, "Busqueda"
K = miregistro.Bookmark
End If

miregistro.Close
mibase.Close

End Sub

Si quieres mas informacion consulta la ayuda de VB vienen muy buenos ejemplos.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar