Solved

Add search box in Access

Posted on 2014-09-10
6
284 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
  • 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 119

Expert Comment

by:Rey Obrero
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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

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 119

Accepted Solution

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

As freelancing is becoming more and more common in the tech industry, certain obstacles are proving to be a challenge to those who are used to more traditional, structured employment. This article is meant to help identify such obstacles and offer a…
A high-level exploration of how our ever-increasing access to information has changed the way we do our jobs.
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.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

867 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

25 Experts available now in Live!

Get 1:1 Help Now