Solved

Add search box in Access

Posted on 2014-09-10
6
296 Views
Last Modified: 2014-09-11
Hello,

A real Access novice here!
I have a access database that I need to enter the primary key and have the fields populate related to that entry.  This works now with the search box that frames the screen but I want to have the search box in the body of the form.  Is this possible?
0
Comment
Question by:1212pro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:macarrillo1
ID: 40315066
I think what you are asking for is a subform.

The Subform would be related via a Foriegn key.

So you would drop a Subform into your main form and map the relationship keys.

Am I understanding your question?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40315076
yes, it is possible.
open from in design view
add a textbox, name it txtSearch

place this codes in the afterupdate event of the textbox

private sub txtsearch_afterupdate()
if me.txtsearch & ""="" then exit sub
with me.recordsetclone
    .findfirst "[primaryKey_FieldName] =" & me.txtsearch
    if not .nomatch then
         me.bookmark=.bookmark
        else
         msgbox "Record not found"
    end if
end with

end sub
0
 

Author Comment

by:1212pro
ID: 40315438
Experts.docx

OK I think I did this right Rey.  Here are some screen shots of what was done.  I cannot put any text in the textbox, is shows #Name?  Maybe I missed something
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:1212pro
ID: 40315451
macarrillo1  Please see the screen shots to see if that answers your question.  Any other suggestions would be helpfull

Thanks
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40315592
change "primaryKey_FieldName" with the actual name of the field that holds the primary key

the textbox "txtsearch" must be UNBOUND (meaning- Control source property must be blank) (see the DATA tab on the property window of the textbox.)
0
 

Author Closing Comment

by:1212pro
ID: 40316740
Nice simple solution.  Works great
0

Featured Post

Don't miss ATEN at NAB Show April 24-27!

Visit ATEN at NAB Show to learn how our "Seamlessly Entertaining" solutions deliver fast, precise video streaming without delays for the broadcasting and media environment. ATEN will showcase its 16x16 Modular Matrix Switch (VM1600) and KVM Over IP Solution (KE6900 series).

Question has a verified solution.

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

Suggested Solutions

Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

733 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