UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> display number of records in query on a form    
 
   
misterbill
post Mar 16 2005, 02:49 PM
Post #1

UtterAccess Member
Posts: 34



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?
Go to the top of the page
 
+
R. Hicks
post Mar 16 2005, 02:53 PM
Post #2

UA Forum Administrator
Posts: 38,073
From: Birmingham, Alabama USA



Is this query also the recordsource for this form ???

RDH
Go to the top of the page
 
+
dannyseager
post Mar 16 2005, 02:53 PM
Post #3

UtterAccess VIP
Posts: 13,031
From: Leicester, UK



msgbox "You have " & Dcount("fieldInQuery","Queryname") & " letters that need to be printed."

This is a example of doing it in a message box
Go to the top of the page
 
+
misterbill
post Mar 16 2005, 02:56 PM
Post #4

UtterAccess Member
Posts: 34



I could make it the recordsource, there is nothing elso on it because it is the main menu.
Go to the top of the page
 
+
misterbill
post Mar 16 2005, 02:57 PM
Post #5

UtterAccess Member
Posts: 34



thanks, but i don't what it to be a message box, just a field in a line of text.
Go to the top of the page
 
+
R. Hicks
post Mar 16 2005, 02:58 PM
Post #6

UA Forum Administrator
Posts: 38,073
From: Birmingham, Alabama USA



If there are not thousands of records return by the query .. use Danny's method.

RDH
Go to the top of the page
 
+
R. Hicks
post Mar 16 2005, 03:00 PM
Post #7

UA Forum Administrator
Posts: 38,073
From: Birmingham, Alabama USA



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
Go to the top of the page
 
+
dannyseager
post Mar 16 2005, 03:03 PM
Post #8

UtterAccess VIP
Posts: 13,031
From: Leicester, UK



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?
Go to the top of the page
 
+
R. Hicks
post Mar 16 2005, 03:09 PM
Post #9

UA Forum Administrator
Posts: 38,073
From: Birmingham, Alabama USA



Normally I just open a recordset to get the value and avoid the domain aggregate functions as if they were the plague ...

RDH
Go to the top of the page
 
+
misterbill
post Mar 16 2005, 03:15 PM
Post #10

UtterAccess Member
Posts: 34



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?
Go to the top of the page
 
+
dannyseager
post Mar 16 2005, 04:53 PM
Post #11

UtterAccess VIP
Posts: 13,031
From: Leicester, UK



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.
Go to the top of the page
 
+
misterbill
post Mar 16 2005, 05:30 PM
Post #12

UtterAccess Member
Posts: 34



Cool! It works! Thank you both very much!
Go to the top of the page
 
+
dannyseager
post Mar 16 2005, 07:35 PM
Post #13

UtterAccess VIP
Posts: 13,031
From: Leicester, UK



no problem
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 10:20 AM