Query in a Form

  • Thread starter Thread starter sebastico
  • Start date Start date
S

sebastico

Hello Coom.

In MS Acces 2003 I have a relational database and I have this sql:

SELECT [TObPClav].ObID, [TObPClav].PalClav
FROM TObPClav.PalClav
WHERE ((([TObPClav].PalClav)="DEVElOP" Or ([TObPClav].PalClav)="RURAL"));

I have a form and I need add a Text box to write the filters (2 or more) as
I do in the criteria field in a query design. If the criteria words are not
in the field, display a message no records found. However, I don't know to
write the code behind the Text Box.
Could you suggest the way to do it?

Thank you very much
 
Yes, the user enters a word into the text box. There is in a field PalClav in
the TObPClav table with the key words. The user types a word (2 to 4) in the
Tex box and runs the query.
The criteria words come from the field PalClav. The table in the database
has a list of keywords.
In a query design view I enter the words (using And, Or, Like) and run the
query.What I need is to do the same but into a form. The user don't know how
to create and run a query's in design view.

Thanks

June7 via AccessMonster.com said:
Not sure what you need. Will user enter value into text box then you want to
use that entry as filter criteria? Use the AfterUpdate event of the textbox,
include code that will use the textbox value in filter statement. Why would
criteria words not be in field (what field, the textbox? where do the
criteria words come from?) If there is a defined set of criteria words, limit
user to those choices. If the textbox is not for user to enter value, what do
you want to do with it?

Does this query work? Ask because think From clause should be: FROM TObPClav
Hello Coom.

In MS Acces 2003 I have a relational database and I have this sql:

SELECT [TObPClav].ObID, [TObPClav].PalClav
FROM TObPClav.PalClav
WHERE ((([TObPClav].PalClav)="DEVElOP" Or ([TObPClav].PalClav)="RURAL"));

I have a form and I need add a Text box to write the filters (2 or more) as
I do in the criteria field in a query design. If the criteria words are not
in the field, display a message no records found. However, I don't know to
write the code behind the Text Box.
Could you suggest the way to do it?

Thank you very much
 
First I apologize for delay u in writing, i was busy away from home.

Yes I would like to know how to build the query or filter string and then to
apply to the form's recordset. Nevertheless, I have to tell you that I have
already over 200 words in the PalClav Field. Does Access have restriction in
number of records for Comboboxes or Listboxes? This is the reason I have been
looking a way to write the keywords and using OR or/and AND in the query's.

Again many thanks for your help.

June7 via AccessMonster.com said:
Again, suggest you limit the user's choices to only what is in the database.
Use listboxes or comboboxes (I use comboboxes). Set the combobox RowSource to
give a list of Distinct values from the appropriate table field. Do you need
to know how to build the query or filter string and then to apply to the
form's recordset?
Yes, the user enters a word into the text box. There is in a field PalClav in
the TObPClav table with the key words. The user types a word (2 to 4) in the
Tex box and runs the query.
The criteria words come from the field PalClav. The table in the database
has a list of keywords.
In a query design view I enter the words (using And, Or, Like) and run the
query.What I need is to do the same but into a form. The user don't know how
to create and run a query's in design view.

Thanks
Not sure what you need. Will user enter value into text box then you want to
use that entry as filter criteria? Use the AfterUpdate event of the textbox,
[quoted text clipped - 21 lines]
Thank you very much
 
Back
Top