Question refering a field in a form as query criteria problem

marianne

Registered User.
Local time
Today, 12:22
Joined
Mar 26, 2009
Messages
327
Hi,

I just could not figure it out. I am using this criteria in a query below"

Like "Forms!Form1!Text0*"

is that correct format? I dont know if that is correct because there is no result when I run the query.

I am using in my search form. Moreover, what event procedure should I use so that everytime I input a letter in my search field, the result in my subform will requery or get updated?

Thanks.
progress.gif
http://www.accessforums.net/editpost.php?do=editpost&p=5359
 
It is not correct. Put this.
Like [Forms]![Form1]![Text0] & "*"
 
thank you very much MStef. anyway can you also tell me on what event procedure should I use that when I input every letter that I want to search, my subform will requery or get updated. thanks.
 
thanks for the reply JANR but I tried OnChange as you suggested but it did not work. do you have other idea.
 
From Access help:

The Change event occurs when the contents of a text box or the text portion of a combo box changes.

So it's should be the right event, something else in the code isen't correct. Probebly refrence to the subform.

JR
 
ok. now i see that OnChange event is really right but it does not immediately update my record. I have to use me.refresh my main form first before an update in the subform is done. how do you find that situation?
 
Can you post a snippet of your mdb to look at?

David
 
this is my db that i work on figuring out how to work on my prob.
 

Attachments

i want to input my text to search in the textbox and everytime i input a letter, the subform should suppose to be updated. yes it is updated but the word that i input in the textbox does not appear as a whole word but only single letter as i type.
 
khawar thanks for your reply. but I cannot seem to open the file because it is not an access file inside the zip file. how can i open it?
 
It is same file you uploaded open it with access directly
 
ok thank you very much sir. i can see that it is working. but may i ask what did you do sir because I have also tried the coding without me.refresh but it did not work?
 
I see. you have added ".text" in my query criteria...

what is that for? I am not familiar with that sir. may I ask it from you what is that for?
 
I have made 2 changes

In your query i used

Like "*" & [Forms]![Form1]![mycriteria].[text] & "*"

instead of

Like "*" & [Forms]![Form1]![mycriteria] & "*"


and second removed me.refresh from code

when you use onchange event you have to use text property of control
 

Users who are viewing this thread

Back
Top Bottom