Solved

Access 2007 Search Question with VBA Coding

Posted on 2011-09-06
2
303 Views
Last Modified: 2012-08-14
I have the following code wrtten in VBA to fnd the Alias1 name.  How can I write the coding to
allow the computer to find an Alias2, Alias3, Alias4, and Alias5 if a entry is made in the TextBox for Alias2 or Alias3, Alias4, or Alias5 and the Find button is selected?

The coding:

Private Sub Command9_Click()

Dim rs As DAO.Recordset

Set rs = Me.Recordset.Clone
rs.FindFirst "[Alias1] = '" & Me.Text10 & "'"
If rs.NoMatch = True Then
    MsgBox "There are No Records Found for this Alias Name.  Please Try Again"
    Me.Text10.SetFocus
Else
    Me.Bookmark = rs.Bookmark
End If
End Sub

Any help is appreciated.

jjc9809
0
Comment
Question by:jjc9809
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 36492673
try, change this

rs.FindFirst "[Alias1] = '" & Me.Text10 & "'"

with

rs.FindFirst "[Alias1] = '" & Me.Text10 & "' Or [Alias2] = '" & Me.Text10 & "' Or [Alias3] = '" & Me.Text10 & "' Or [Alias4] = '" & Me.Text10 & "' OR [Alias5] = '" & Me.Text10 & "'"
0
 

Author Closing Comment

by:jjc9809
ID: 36492718
Very Good

Thanks
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question