Search width jokersigns

cjfmagnusson

user®
Local time
Today, 22:37
Joined
Aug 22, 2007
Messages
8
Edit : Jokersigns=wildcards

Hello!
First of all I want to beg you pardon for my English, I hope you will understand me .

I have a question about how to search in Access widthout Access's own tool. I have a database width hundreds of booktitles. And I want to search from them width jokers. But how to? I have managed to do a parameterquery like this:

SELECT *
FROM Query1
WHERE ([Query1]![Title]) LIKE ("*" & [What do you want to search] & "*");


But i want the query to referer to a field in the form. Like this:

SELECT *
FROM Query1
WHERE ([Query1]![Title]) LIKE ("*" & [Forms]![Form1]![Textbox1] & "*");


But it doesn't works. Please help me!

/cjfmagnusson
 
Last edited:
That is the way to do it, however it will fail if the form/control is spelt incorrectly or the form is not open.
 
I would have written the WHERE clause this way without the ! in the table/field name

WHERE ([Query1].[Title]) LIKE ("*" & [Forms]![Form1]![Textbox1] & "*");
 
I would have written the WHERE clause this way without the ! in the table/field name

WHERE ([Query1].[Title]) LIKE ("*" & [Forms]![Form1]![Textbox1] & "*");

? It doesn't matter, I think. The first part was al right already.
 
Sorry, it wasn't my thought to say you were wrong, it works your way too, I just was tired on answeres which doesn't gave me the solution of the priimary problem. Thanks still for your answer.

/cjfmagnusson
 
SELECT *
FROM Query1
WHERE ([Query1]![Title]) LIKE ("*" & [Forms]![Form1]![Textbox1] & "*");

Does your Swedish version of Access use the word Forms?
Just a shot in the dark, for otherwise the query is quite OK.

^
 
When you say it's not working, what do you mean ? Does the query run? Are any records returned? Are there any error messages?

Double check what Dennisk said:
- check form name and text box name are correct
- ensure the form is open when you run the query

Also ensure that you have exited the textbox i.e. that the textbox has lost the focus e.g. by moving to another field in the form. This ensures that the text is recognised as the value of the textbox.

Are you using a subform? Controls on Subforms are referenced differently.

If you still have a problem then check your reference by creating another textbox and putting =[Forms]![Form1]![Textbox1] as the control. The run the form and enter somehting in textbox1 and move to another field. If your second textbox isn't showing the same value then you have a problem with your references.

hth
Stopher
 
Does your Swedish version of Access use the word Forms?
Just a shot in the dark, for otherwise the query is quite OK.

^

No, I just wrote it down because I thought your swedish were not so good ;)
In my query I have written like this:
[Formulär]![Sökformulär]![Titelsök]
and it means:
[Form]![Searchform]![Titlesearch]

##############################

The problem is that Access think that [Formulär]![Sökformulär]![Titelsök] is a parameter query. It popups a small msgbox or what you will call it width the text "[Formulär]![Sökformulär]![Titelsök]" and asks for a parameter. If I then write the same as in the textbox "Titelsök" in the form I will got the right results of the query.

I can send an image. I hope it will help you to understand my problem.

skarmdump.jpg


Here is the adress if there are some problem with the image above.
http://img14.imgspot.com/u/07/234/14/skarmdump.jpg

Thanks to everyone that helps me!
/cjfmagnusson
 
Then will it work if you write [Forms]![Sökformulär]![Titelsök] ?

^
 
Hahaha..it works!!:)
I'm so happy! Crasy swedish Accessversion, and crasy swedish programmer (me) ;)
Thank you so very, very much.

Just one more question, how to update the subform when I click on the search button?
 
If the Record Source of the subform is the query, you can simply requery the subform from the On Click event of the search button:-

Me.yourSubformName.Requery
.
 
In the "Help" in my Access, they say that an update can't select new columns (because its a query) and that I have to run the query once again. How can I do that?

I find this
Docmd.OpenQuery "Fråga2"

But it just opens the query. I need another VBcode
 
Last edited:

Users who are viewing this thread

Back
Top Bottom