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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

counting problems...

Status
Not open for further replies.

jordanh

Technical User
Nov 11, 2002
47
GB
I have a text box on a form which contains a query that uses variables entered on the form.

It is basically a way of filtering the list. You type in a keyword or value for any of three fields and it requeries the list with the new criteria.

I need a way of counting the records in the list, as the query is pretty complicated and involves ()'s, using DCount("[field]","[data]","Big Long Query") isn't working. Is there a way of getting Dcount to count the records in a query on a form?

form = [search]
textbox containing the query = [search_results]

so why can't I use DCount("[search_results]","[search]") to count them? Am I doing something wrong? Can this be acheived any other way?

Thanks for your time

Jordan

PS the query is...

SELECT DISTINCTROW [Query1].[System], [Query1].[Subsystem],[Query1].[Plant item], [Query1].[Passport ID], [Query1].[Room identifier] FROM [Query1] WHERE ([Query1].[System] Like "*" & keyword & "*" OR [Query1].[Plant item] Like "*" & keyword & "*" OR [Query1].[Subsystem] Like "*" & keyword & "*") AND [Query1].[System] Like "*" & ssystem & "*" AND [Query1].[Subsystem] Like "*" & ssub & "*" AND [Query1].[Plant item] Like "*" & sitem & "*";
 
when I say 'text box' I do of course mean 'list box' sorry.
 
apologies again, I've sorted it now, there was a silly mistake in my DCount statement.

That's not to say that if you do know a way of counting the records in a list box in a simpler way (than running the whole query through DCount), I would be most grateful to know what it is!

Thanks.

Jordan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top