Solved

Access 2007 Search Question with VBA Coding

Posted on 2011-09-06
2
279 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 119

Accepted Solution

by:
Rey Obrero 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

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…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now