Instant Search Box In Access Form (Search Function in Navigation Bar) (1 Viewer)

FoxRocks

Registered User.
Local time
Tomorrow, 00:08
Joined
Apr 24, 2012
Messages
35
The sample posted here may be of interest to you

Hi John,

I was trying out that search box code you kindly supplied and I'm having a problem with it. I didn't want to hijack this thread, but I also couldn't see another way. I tried to private message you, but I didn't see that option anywhere (maybe on purpose?) and the thread you have the code in is locked. Please tell me if I should contact you a different way about my problem. Anyways what was happening is that when I opened the form I would get a pop up search box with the code I entered in the "criteria" as the window title. It was weird, I got it when I opened the query as well as the form. Any ideas?

Thanks :)
 

John Big Booty

AWF VIP
Local time
Tomorrow, 05:08
Joined
Aug 29, 2005
Messages
8,263
Hi John,

I was trying out that search box code you kindly supplied and I'm having a problem with it. I didn't want to hijack this thread, but I also couldn't see another way. I tried to private message you, but I didn't see that option anywhere (maybe on purpose?) and the thread you have the code in is locked. Please tell me if I should contact you a different way about my problem. Anyways what was happening is that when I opened the form I would get a pop up search box with the code I entered in the "criteria" as the window title. It was weird, I got it when I opened the query as well as the form. Any ideas?

Thanks :)

Simply start a new thread with a link back to the sample and state your question.
 

FoxRocks

Registered User.
Local time
Tomorrow, 00:08
Joined
Apr 24, 2012
Messages
35
Cheers, thanks John :)
 

Roger555

New member
Local time
Today, 15:08
Joined
May 19, 2012
Messages
7
John,
I managed to setup your awesome dynamic search on my database base but I have a few questions. I want to be able to double click on the search results taking me to my “Detailed” form which basically shows the same data as my search just more fields are populated. ( I only have one main list). Any advice ?? I’ve been looking and search for a few hours and I can seem to get it working.
 

Rocker

New member
Local time
Today, 12:08
Joined
Feb 15, 2013
Messages
2
The problem was in the Query you had too many criteria for the Frame, which meant that your query was really only functioning when you made a selection from the frame.

I've removed one of the frame criteria and your form now works.



Hey John.

Hope you happen to see this message.

I downloaded the zip. And I'm curious about whenever I type "Nu" in the SearchFor text.

Why does it give an error ?

Error:

Run-Time error '2110'

Microsoft access can't move the focus to the control SearchResults.


Do you know why that happens?

thanks in advance.
 

John Big Booty

AWF VIP
Local time
Tomorrow, 05:08
Joined
Aug 29, 2005
Messages
8,263
Hey John.

Hope you happen to see this message.

I downloaded the zip. And I'm curious about whenever I type "Nu" in the SearchFor text.

Why does it give an error ?

Error:

Run-Time error '2110'

Microsoft access can't move the focus to the control SearchResults.


Do you know why that happens?

thanks in advance.

Welcome to the forum.

I've just downloaded the sample again, and must say I can not replicate the error your report :confused: Have you made any changes to the database?
 

Rocker

New member
Local time
Today, 12:08
Joined
Feb 15, 2013
Messages
2
Welcome to the forum.

I've just downloaded the sample again, and must say I can not replicate the error your report :confused: Have you made any changes to the database?

Nope. Haven't changed anything.

I've downloaded the file (Dynamic Multi Search) once again, without making any changes and this is what I show when typing "nu" (it automatically changes to "nu") and displays the following:

http : // i. imgur . com/uGEONX1.png

just remove the spaces in the link

I could not post links :(
 

John Big Booty

AWF VIP
Local time
Tomorrow, 05:08
Joined
Aug 29, 2005
Messages
8,263
Firstly probably best to start your own thread.

Secondly I can't open your link have a read of this thread, as to how to upload your image.

Finally there have been other similar problems reported relating to other characters. The only explanation I can think of is that there is some system setting that is being used that causing these errors. There is certainly nothing in the code that is causing the problem, so there must be some system setting that is not playing nice.
 

bradl

New member
Local time
Tomorrow, 05:08
Joined
Apr 26, 2013
Messages
1
Hi John, I followed your instructions for the search form and when I open the search form I get a popup message asking me to enter parameter value for some of the fields I setup in the query.

I can enter through the popups and open the form however when I type in the searchfor section I get another popup saying the expression on change you entered as the event property setting produced the following error: invalid outside procedure.

Any ideas on where I went wronge?
 

John Big Booty

AWF VIP
Local time
Tomorrow, 05:08
Joined
Aug 29, 2005
Messages
8,263
It sounds as if you have not got a reference correct some where in your code. Or you have not change the name of one of the controls on the form to match either the code or the query.
 

johnkrytus

Registered User.
Local time
Today, 15:08
Joined
Mar 7, 2013
Messages
91
@John Big Booty, I can't believe I've lived this long without your search!
I have it working but I am hoping you can coach me through my next couple steps of implementing it.

1) I tried unsuccessfully to take the case sensitivity out of it by using LCase. I tried making the query strings LCase and/or the comparison strings in the code. It doesn't error. But it doesn't work either. Actually it seems to make the search "churn" a bit.

2) I want to select a resulting record and then open a new form that contains it. I've bound the id column in the query. But I dont know how to grab that value from a list box.

Can you possibly point me in the right direction?
 

John Big Booty

AWF VIP
Local time
Tomorrow, 05:08
Joined
Aug 29, 2005
Messages
8,263
@John Big Booty, I can't believe I've lived this long without your search!
I have it working but I am hoping you can coach me through my next couple steps of implementing it.

1) I tried unsuccessfully to take the case sensitivity out of it by using LCase. I tried making the query strings LCase and/or the comparison strings in the code. It doesn't error. But it doesn't work either. Actually it seems to make the search "churn" a bit.

...
The search is not case sensitive :confused:

...

2) I want to select a resulting record and then open a new form that contains it. I've bound the id column in the query. But I dont know how to grab that value from a list box.

Can you possibly point me in the right direction?
Have a look at the Double Click event of the List box.
 

johnkrytus

Registered User.
Local time
Today, 15:08
Joined
Mar 7, 2013
Messages
91
As usual I missed the really obvious. I'm new here and didn't see the attached database file zipped up there. I was only looking at the code in the thread. Wow, you did all the hard work! Imagine how stoked I am now.
- - - - -

I checked it out and it appears the reason mine is case sensitive is that my database is in PostgreSQL. The reason why is a long story and has to do with my friend being a Rails guy...
 
Last edited:

pbouk

New member
Local time
Today, 12:08
Joined
May 31, 2013
Messages
3
@JohnBigBooty
Your code is working really well, but I am now getting an error message, whenever I type the letter "i" in my search box. It's very weird. It may have always done that, I haven't used this search box very thoroughly so I'm not sure if its a new problem or it was there from the start.
Have you encountered this before?
It's a runtime 2112 error, and the debugger takes me here (in bold):

'Set the focus on the first item in the list box:

Me.SearchResults = Me.SearchResults.ItemData(1)
Me.SearchResults.SetFocus


'Requery the form to refresh the content of any unbound text box that might be feeding off the record source of the List Box
DoCmd.Requery


'Returns the cursor to the the end of the text in Text Box SearchFor
Me.SearchFor.SetFocus


If Not IsNull(Len(Me.SearchFor)) Then
Me.SearchFor.SelStart = Len(Me.SearchFor)
End If
End Sub


Private Sub SearchFor_GotFocus()

End Sub

Private Sub SearchResults_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmDirectoryView"

stLinkCriteria = "[ContactID]=" & Me![SearchResults]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub

Private Sub Text19_DblClick(Cancel As Integer)

Me.SearchFor.Value = ""

End Sub
 

John Big Booty

AWF VIP
Local time
Tomorrow, 05:08
Joined
Aug 29, 2005
Messages
8,263
pbouk, this has been reported previously, however there is nothing in the code that should be producing this type of behaviour. I suspect that it may be being caused by some system setting outside of Access. I have never been able to reproduce this error :confused:

If you can post a copy of your DB I will take a look at it and see if I can identify the problem.
 

pbouk

New member
Local time
Today, 12:08
Joined
May 31, 2013
Messages
3
Thank you.
I would rather not post my database here for confidentiality reasons. Can I send it to you privately?
 

pbouk

New member
Local time
Today, 12:08
Joined
May 31, 2013
Messages
3
Hi there john big booty - I found the other reference to this bug in the posts here, and it looks like someone has offered a correction to the code, so it's fixed now. I used it and my search box works fine.

Thanks again for offering to look at my database.
 

hakerzz11

New member
Local time
Today, 12:08
Joined
Dec 5, 2013
Messages
1
hey guys please do help me. I have a database with 79 column. "Country" on the 1st columns, "Variety Name" on the 2nd etc. etc.. I want to create a search box on a form that when I type a country like peru all the files that in the country peru will show peru ONLY.,how will I do that?,please help me :( , I need the codes please,i'm not using any list box or combo box.,just a plane form a command botton and 2 text boxes

any help will be appreciated :)
 
Last edited:

krelian03

New member
Local time
Tomorrow, 03:08
Joined
Mar 24, 2014
Messages
1
Hi, John.

Thank you for the great Dynamic Search String!

You mentioned that in order to search for multiple criteria, I would need 2 text boxes.

How exactly can we do that?

Thanks.
 

leo_7

New member
Local time
Tomorrow, 00:38
Joined
Sep 14, 2014
Messages
1
Dear John,

I am really thankful for the post on implementing Search field in access. I had succeeded in implementing the same but after sending it to the client, he called me back and said that this isn't working and since then I haven't slept properly. Will you please let me know what has gone wrong and where? The only reason I can recollect is, of a hang in the access application that had occured before sending the file. And now since 2 days I am cracking my head to know what's the error. I could make out that the query isnt working but I have followed the same steps that you have suggested!!! It would be of great help if you can show me that. Here's my access db. Password for the db: CD@123
 

Attachments

  • myContactDB.accdb
    1 MB · Views: 270

Users who are viewing this thread

Top Bottom