misterbill
Mar 16 2005, 02:49 PM
I have a form where I want to put a sentence that says "you have (# of records from query) letters that need to be printed."
The query that I am referring to is called "letterstoprint"
How do I make it display the number of records in a query?
R. Hicks
Mar 16 2005, 02:53 PM
Is this query also the recordsource for this form ???
RDH
dannyseager
Mar 16 2005, 02:53 PM
msgbox "You have " & Dcount("fieldInQuery","Queryname") & " letters that need to be printed."
This is a example of doing it in a message box
misterbill
Mar 16 2005, 02:56 PM
I could make it the recordsource, there is nothing elso on it because it is the main menu.
misterbill
Mar 16 2005, 02:57 PM
thanks, but i don't what it to be a message box, just a field in a line of text.
R. Hicks
Mar 16 2005, 02:58 PM
If there are not thousands of records return by the query .. use Danny's method.
RDH
R. Hicks
Mar 16 2005, 03:00 PM
Just use the approach as the Control Source of a txtbox on the form ...
CODE
="You have " & DCount("FieldInQuery","QueryName") & " letters that need to be printed."
RDH
dannyseager
Mar 16 2005, 03:03 PM
Just out of interest Ricky at what point (how many records) would you move away from a Domain Aggregate Function in favour of specifying a recordset?
R. Hicks
Mar 16 2005, 03:09 PM
Normally I just open a recordset to get the value and avoid the domain aggregate functions as if they were the plague ...
RDH
misterbill
Mar 16 2005, 03:15 PM
I tried typing
& DCount("letter_printed","letter_need_printing") &
into the control source for the text box, but then the form says " #Name?"
I also tried it without the & symbols, but I get the same error. Am I supposed to be putting this somewhere else?
dannyseager
Mar 16 2005, 04:53 PM
Try copying exactly what ricky posted, pasting it into the control source of a text box control and then changing the
("FieldInQuery","QueryName")
to
("letter_printed","letter_need_printing")
This assumes that your Query is called letter_need_printing and that in that query you have a field called letter_printed.
Ricky, Thanks for the insight - always nice to know other peoples methods, they may be better than the ones I currently use.
misterbill
Mar 16 2005, 05:30 PM
Cool! It works! Thank you both very much!
dannyseager
Mar 16 2005, 07:35 PM
no problem
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.