This seems like it should be so easy to do. I have a table, called tblTopics. Each topic can have one or more instances, contained in a table called tblTopicInst. tblTopics is bound to a form called frmTopics and tblTopicInst is bound to a form called frmTopicInst. From frmTopics, you access frmTopicInst via a button. I have also created a query, qryCountInst, that counts the number of instances for the topic currently displayed on frmTopics. I want to add a text box, txtCountInst, to frmTopics to display the number of instances for the topic--i.e., the results of qryCountInst. I also want to add a button to refresh this count. After searching all the Access documentation I have, I can't find any info on how to display the results of a COUNT query in a text box. The expression that Access "helps" me build--[qryCountInst]![total_record]--doesn't work either. How can I accomplish this simple thing? Thanks for your help!
3 4884
FYI, I kept looking and finally was able to get it working using DCount. Still no way to auto-refresh, but that's not really critical. I can add a button or something if it proves to be a need.
Specifically, I created the text box and added this as the Control Source:
=DCount("top_id ", "tblTopicIn st", "top_id = Forms!frmTopics !top_id")
Hi. DCount is a good solution for what you need to do. There are several ways to refresh the value calculated. One such is to use the On Current event of the form itself, which fires once for each record you move to.
In your form properties right-click on On Current and select build. A skeleton of the event sub is created for you. Just add - Me![name_of_your_control].Requery
where name_of_your_co ntrol is replaced by the actual name of your textbox with the DCount control source.
This will requery the DCount for each record of the form without your users having to press any 'refresh' buttons to do so.
-Stewart
Actually, using the OnCurrent event doesn't work because you never leave the form on which the count is displayed. You add the new record on a separate form, so perhaps there would be a way to trigger a requery when the other form closes. I'll look into that, but it's not a showstopper. I appreciate your suggestion, though--thanks very much.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: erica |
last post by:
Hi,
I am currently writing PHP code for some polling software. When someone
votes, it stores their IP address in the database. From then on, they
cannot vote in that particular poll, they only view the results. There
are several polls in the database, and there is a field called
"status". When it is 0, the poll is "active" and can be voted upon.
When it is 1, it is archived and one can only view the results.
But, there seems to be...
|
by: geronimo_me |
last post by:
I have 20 queries that compare fields in one table with fields in
another table - the query results are the records that do not match in
Table1 and Table2. ie
Table1
DOB 28/02/78
Table2
DOB 27/02/78
|
by: google |
last post by:
This is something I've done plenty of times in '97, but I can't seem to
get it to work correctly in Access 2003. Say, for example, I have a
form with an unbound combobox, the data source is a table of customers,
first column is the key field, which is hidden with a 0" width, and the
second column is the customer name. The SQL is a union query that also
inserts Null in the first column, and "All" in the second column. That
combobox gets...
|
by: Joe Van Meer |
last post by:
Hi,
Is the datalist meant for one table or can I use it to display information
from 2 different tables? Or should I be looking at a datagrid instead?
I began my code and kinda ran into a snag where my last two columns I am
displaying are ID fields, one for clientid and the other for empid.
What I would really like is to display their actual names instead of the
ids.
|
by: sunilkeswani |
last post by:
Hi
I am still new to access. I want to know how i can build a query which
can display results from 4 different columns/fields
Like.
Field1 Field2 Field3 Field4
1 2 1 0
1 1 0 0
| |
by: PHPBABY3 |
last post by:
Hi,
1. I have two SQL tables. I will call them employees and departments:
EMP: LAST_NAME, FIRST_NAME, DEPTNM
DEPT: NUM, NAME
Input: text string FIND
Output: the LAST_NAME, FIRST_NAME and department name NAME (link DEPTNM
|
by: bruce24444 |
last post by:
First of all I'm new to the forum and am working on my first database. So far I think I've done not too bad but have hit a stumbling block for which I'm not sure how to get around.
What I have is a database which tracks assigned files to a certain people which is generated by a form and then recorded into a table. Tables are as follows “Staff” “Loss_Type” and “Claims_Assignment”.
From this “Claim_Assignment” table I have created separate...
|
by: Yitzak |
last post by:
Have a query that is arregated into crosstab query, it is working
correctly.
select Yes as selected from tblname
or
select true as selected from tblname
Produces -1 ( vba value of True) in the results pane I would like to
see it produce a checkbox with tick in just like I would see if I
displayed a boolean/yes/no field from a table.
|
by: petter |
last post by:
Hi!
I have two questions: one question that regards the COUNT-function, and one about how to display a month even if I don’t have any data for that month.
I have an Access database where I want to create a query to count all the internal units in my list (the “input”-table), between two dates. I want my list to be grouped by year and month. Here is the SQL-code, as called from VBA:
strSQL_INTU1 = "PARAMETERS DateTime, DateTime;" _
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |