Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Instant or 'live' query

Status
Not open for further replies.

Islwyn

Programmer
Nov 8, 2003
26
0
0
GB
I want a form ("booksearch") that contains a list of data to be instantly updated from a query ("querytitle") whos source is a box in another form ("findbook") (or perhaps in the header of "booksearch").
In other words I'd like the list to be instantly updated as I type each letter. Could anyone tell me how I'd go about doing this simple thing.

Thankyou
 
Hi,

use the on change event of your textbox to requery your list i.e.
Code:
Private Sub txtFilterBooks_Change()
YOUR_OTHER_FORM.Requery
End Sub
I assume you're okay with the underlying query?

HTH, Jamie
FAQ219-2884
[deejay]
 
Hi, thanks for your answer

I have tried that but all I get is an "Object Required" message so it isn't finding "YOUR_OTHER_FORM" despite the fact it is open.

With regard to the underlining query how do I use a wildcard in my query which filters using the value in the textbox?

In other words I want something that finds "the*" or "*of the*"

This is what I thought would work:

SELECT BOOKS1.[Author], BOOKS1.[Title], BOOKS1.[ISBN]
FROM BOOKS1
WHERE (((BOOKS1.[Title])=[Forms]![Form1]![Text7]*));

or

.....WHERE (((BOOKS1.[Title])=[Forms]![Form1]!*[*Text7*]));

but neither do

Cheers

Islwyn
 
Hi,

sorry, it should be forms!yourform.Requery - to use the * wildcard you'll need to use LIKE rather then = in the where clause, i.e.
Code:
SELECT BOOKS1.[Author], BOOKS1.[Title], BOOKS1.[ISBN]
FROM BOOKS1
WHERE (((BOOKS1.[Title])[highlight] LIKE [Forms]![Form1]![Text7] & "*"[/highlight]));
should work fine...

HTH, Jamie
FAQ219-2884
[deejay]
 
Many thanks - that seems to work within a single form but not with two forms open (i.e. refering to a second form that is open) There is no error this time but the form simply isn't requeried. Any ideas?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top