Command button on form to display all matches in query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Wilson
    New Member
    • Jan 2011
    • 1

    Command button on form to display all matches in query

    Access 2003 Sp2 – Pretty new to Access so please bear with me!

    I have created a simple database which has 4 tables with matching column names but info from different systems. I have merged some data using a simple query with Union statements.

    [
    SELECT [User Id], [Name], [System] FROM systemA_ids
    UNION SELECT [User ID], [Name], [System] FROM systemB_ids
    UNION SELECT [User ID], [Name], [System] FROM systemC_ids
    UNION SELECT [User ID], [Name], [System] FROM systemD_ids
    ORDER BY [Name], [System];
    ]

    What I want to do as create a form where I can input a string and click on a command button which will then display me all matches from the merged data query.

    I have created a form but can not get the VBA to work.

    [
    Private Sub Command2_Click( )
    If IsNull(Text0) = False Then
    Me.Recordset.Fi ndFirst "[Name]=" & Text0
    Me!Text0 = Null
    If Me.Recordset.No Match Then
    MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
    Me!Text0 = Null
    End If
    End If
    End Sub
    ]

    Am I making this too complicated?
    Any pointers would be great.

    Thanks
Working...