Solved

Add search box in Access

Posted on 2014-09-10
6
289 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 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

In this article I will provide some simple productivity hacks that will help you use Google to specifically show results from any web site (Experts-Exchange.com in my example), with minimal effort in Chrome and Firefox. I've seen a common theme a…
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.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

770 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