View Full Version : How to find Total Results - Expressions or Visual?


Jk45
11-29-2007, 05:15 AM
Hi. I have recently made a video database for a project, and have have come to a small problem. What I wanted to do was to, using a query search, find the total number of results found, in a form.

Basically, I have a query, in which I have the Film Name, Movie Cost e.t.c, with - Like ("*" & [Film Name], as the Expression (under Film Name).

When using the query, it retrieves results for what you have typed.

I use the query on a form "Film Search", which when clicked on Automatically brings up the Search Box. I also have another form "Films", which has a "Search Films" command button on it, run from a Macro. So basically everything works fine, but I when I search for a film, I want to have a text box, on the form, which has a count for the results.

For example, if I searched say "Shrek", and I got results for Shrek, Shrek 2 and Shrek 3, the text box would say - " 3 results found".

This brings me to the conclusion of asking if I should do an expression, from the original query I am using, or to use Visual Basic, and more importantly - HOW?!?

Any help would be GREATLY appreciated, and I am sorry in advance if one, I have not explained my problem well enough, and two, this is in the wrong section.

Thanks in advance

Jk

ajetrumpet
11-29-2007, 10:02 AM
when I search for a film, I want to have a text box, on the form, which has a count for the results.

For example, if I searched say "Shrek", and I got results for Shrek, Shrek 2 and Shrek 3, the text box would say - " 3 results found".Jk,

This would be best done in VB, and here's how...Private Sub_OnFormEventOfYourChoice

me.txtbxName = DCount("[MovieNameField]", "QueryName") & " " & "results found"

End SubFor you to get any results whatsoever, the query has to be opened, so the DCount function will have no problem counting the number of records that are returned.

Jk45
11-30-2007, 06:56 AM
Hey Aj. Thanks for the reply - Sorry I haven't replied quicker.

I will check if your solution works on Monday, when I can use my database.

I have also added to your reputation, and again I must say thanyou for your reply.
I will also try to reply to you once I try the solution.

Thanks once more,

Jk