How to make a Macro that performs a search of a table in Ms Access?

0

I have a Access Database in which I look for registered users

When I perform a search, it generates results, when I click to see the information, it does not generate any of the information I added.

This is the macro that executes the search procedure.

Option Compare Database
Private Sub Comando122_Click()
Lista123.Requery
End Sub
Private Sub Lista123_AfterUpdate()
 Dim rs As Object
Set rs = Me.Recordset.Clone
    rs.FindFirst "[id] = " & Str(Nz(Me![Lista123], 0))
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
    
asked by Jhonatan cardona 05.09.2018 в 20:47
source

1 answer

1

I think it's a query to bring you the info, I would do it like that When you already have the name you are looking for, double-click on it and in that event hang the query so that it takes the info to the controls

A query more or less like that

obSQL = "Select * from " & DestinoFacturas & " Where " & _
  DestinoFacturas & ".FiscalNumber = '" & ValorActual & "';"
Set conAccess = New ADODB.Connection
With conAccess
  .Provider = "Microsoft.ACE.OLEDB.12.0"
  .Properties("Jet OLEDB:Database Password") = MiPasswordAccess
  .ConnectionString = "Data Source=" & MiRutaCAccess & ";"
  .Open
  Set Datos = conAccess.Execute(obSQL)
    If IsNull(Datos.Fields(0)) Or Datos.EOF Then
      CmbBMidato = ""
    Else
      CmbBMidato = Datos.Fields(0)
      CmbBMidatoI = Datos.Fields(0)
    End If
  .Close
End With
    
answered by 07.09.2018 / 22:25
source