Problems with field on form used in criteria

  • Thread starter Thread starter Kevin R
  • Start date Start date
K

Kevin R

Hi all.
I have a select query with one of the criteria set to
Like "*" & [txtSearch].[Text] & "*"

On the form based on the query I have a text box called
txtSearch which has a Change event which just calls Me.Requery

Whenever the form opens or requeries, I am prompted for the parameter
txtSearch.Text
The query doesn't seem able to see the control on the form, it is in
the form's header

I have another form which has a field called txtSearch and has a
subform which is based on the query results and this one works fine
using the same query.

I've run out of ideas and would be grateful for any help anyone could
offer

TIA

Kevin R.
 
Kevin said:
I have a select query with one of the criteria set to
Like "*" & [txtSearch].[Text] & "*"

On the form based on the query I have a text box called
txtSearch which has a Change event which just calls Me.Requery

Whenever the form opens or requeries, I am prompted for the parameter
txtSearch.Text
The query doesn't seem able to see the control on the form, it is in
the form's header

I have another form which has a field called txtSearch and has a
subform which is based on the query results and this one works fine
using the same query.


I migt be jumping in over my head here, but I think the
problem is with using the Text property. The Text property
only has meaning while the text box is being edited and can
not be used unless the text box has the focus. It may(?)
work during the text box's Change event, but it's unlikely
to work at other times,

Perhaps, you shoud add an invisible text box that you can
use in the query and set its Value in the search text box's
Change event. Set it to some other appropriate value that
you want to use at other times.
 
Kevin said:
I have a select query with one of the criteria set to
Like "*" & [txtSearch].[Text] & "*"

On the form based on the query I have a text box called
txtSearch which has a Change event which just calls Me.Requery

Whenever the form opens or requeries, I am prompted for the parameter
txtSearch.Text
The query doesn't seem able to see the control on the form, it is in
the form's header

I have another form which has a field called txtSearch and has a
subform which is based on the query results and this one works fine
using the same query.


I migt be jumping in over my head here, but I think the
problem is with using the Text property. The Text property
only has meaning while the text box is being edited and can
not be used unless the text box has the focus.

This is the behaviour I am looking for, the idea is that as the user
types more characters in the text box, the number of records
displayed is narrowed down. I could probably have used the keypress
event instead.

I have it working now, I put the query results in a sub form and have
the subform requery its self everytime the user types a key in the
textbox on the main form.

Perhaps requerying the form which contains the search text box
is causing the problem, it is an unbound text box and maybe it
is getting messed up when the form requeries.

Thanks for the suggestions anyway

Kevin R.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top