My Assistant
![]() ![]() |
|
|
Jun 27 2010, 04:51 PM
Post
#1
|
|
|
New Member Posts: 1 |
I have a very simple access database with just 1 table. I want to put a search box in to a new form. I want to be able to type in a last or first name and for it to return the details in that table for that person. Surely this is very simple but I have no idea where to start. I am using access 2010
|
|
|
|
Jun 27 2010, 05:14 PM
Post
#2
|
|
|
Access Wiki and Forums Moderator Posts: 48,013 From: SoCal, USA |
Hi,
(IMG:style_emoticons/default/welcome2UA.gif) Having only one table in a database is not normal. If you are planning on using this database for things other than searching for names, you might look into "Normalization" concepts. The other thing we recommend is to not work with the data at the table level. We suggest that you create a form to also display the information after the search is done. For example: 1. Create a query based on your table. 2. In the Criteria row for the FirstName field, type in: Like [Enter Search Name] & "*" 3. In the row just below the criteria you just entered and under the LastName field, type in the same criteria: Like [Enter Search Name] & "*" 4. Now, create a new form based on that query. When you open the form, Access will prompt you to enter a search word, and the form will open with all the records where the first and last names start with the words you entered in the dialog box. Hope that helps... |
|
|
|
Jun 27 2010, 08:12 PM
Post
#3
|
|
|
UtterAccess VIP Posts: 18,396 From: Oklahoma City, Oklahoma |
Another option would be to use the Combo Box control wizard to add a search box to the form's header.
|
|
|
|
Apr 3 2012, 11:30 AM
Post
#4
|
|
|
UtterAccess Veteran Posts: 338 |
Reviving an old thread - This gets me close to what I need, but without closing and reopening the form every time, how do I get the search box back up?
Using this on a form, but my guys will generally have more than one file to sign off on. Edit: added second line of entry This post has been edited by marineco: Apr 3 2012, 11:31 AM |
|
|
|
Apr 3 2012, 11:38 AM
Post
#5
|
|
|
Access Wiki and Forums Moderator Posts: 48,013 From: SoCal, USA |
Hi,
See if Allen Browne's Find As You Type technique helps. Just my 2 cents... (IMG:style_emoticons/default/2cents.gif) |
|
|
|
Apr 3 2012, 11:39 AM
Post
#6
|
|
|
UtterAccess Veteran Posts: 312 From: Las Cruces, NM |
Why not just have a command button on the form that calls the search box...
|
|
|
|
Apr 3 2012, 11:41 AM
Post
#7
|
|
|
UtterAccess Veteran Posts: 338 |
Brian,
That's what I'm hoping for, but I know very little about command boxes yet. My first attempt was earlier today, and I couldn't figure it out. |
|
|
|
Apr 3 2012, 11:46 AM
Post
#8
|
|
|
UtterAccess Veteran Posts: 312 From: Las Cruces, NM |
Just put the button on the form, and then attach it to an "on click" event to run your code for the searching box...
|
|
|
|
Apr 3 2012, 11:56 AM
Post
#9
|
|
|
UtterAccess Veteran Posts: 338 |
I don't have any idea what that code is. I put Like [Enter Search Name] & "*" in my two fields that I want the search to look at, as mentioned by theDBguy in his original response. Now when I open the form, a popup automatically comes up. I didn't (manually) create any code (Access may have done it for me behind the scenes), it just happens.
But it only comes up the one time. |
|
|
|
Apr 3 2012, 12:16 PM
Post
#10
|
|
|
UtterAccess Veteran Posts: 312 From: Las Cruces, NM |
Make a macro that runs your search-box query. Then just attach your command button to that macro, in the "on click" event for the command button...
This post has been edited by briangriffey: Apr 3 2012, 12:17 PM |
|
|
|
Apr 3 2012, 12:26 PM
Post
#11
|
|
|
UtterAccess Veteran Posts: 338 |
I do appreciate the attempt, but unfortunately, that brings us back to my last post. I don't know what to put into a macro to bring the box up. It just happens when I open the form. I didn't create it. The only thing I can think of is telling the macro to close and reopen the form, which is exactly what I am trying to avoid.
|
|
|
|
Apr 3 2012, 12:34 PM
Post
#12
|
|
|
Access Wiki and Forums Moderator Posts: 48,013 From: SoCal, USA |
...The only thing I can think of is telling the macro to close and reopen the form, which is exactly what I am trying to avoid. And if you take a look at Allen Browne's approach in the link I posted earlier, I think you can achieve that. Just my 2 cents... (IMG:style_emoticons/default/2cents.gif) |
|
|
|
Apr 3 2012, 12:43 PM
Post
#13
|
|
|
UtterAccess Veteran Posts: 338 |
DB Guy, That is something that will probably get implemented elsewhere in the database, further down the line. But unfortunately it's not dummy-proof enough for this specific one. However, I think you solved this problem as well in my other post. If I create the form that comes up vs the one Access does automatically, then I know what I am trying to call on. I should be able to make a macro now. So double thanks! (IMG:style_emoticons/default/notworthy.gif) |
|
|
|
Apr 3 2012, 01:02 PM
Post
#14
|
|
|
Access Wiki and Forums Moderator Posts: 48,013 From: SoCal, USA |
|
|
|
|
Apr 3 2012, 03:14 PM
Post
#15
|
|
|
UtterAccess Veteran Posts: 312 From: Las Cruces, NM |
Can you post the database, so we can see what you have?... or is the data confidential?
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 22nd May 2013 - 04:05 PM |