473,480 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

update a query count on main form when subform is updated

Hi everyone,

I have a subform in datasheet view that is used to display the
contents of a single table. I have another subform with a query
feeding it to give a count of how many particular items are in the
table and wanted to ask how I go about updating the count when I
delete a value from the datasheet subform without closing and
reopening the form?

Many thanks for any help you can offer...

Dean...
Jun 27 '08 #1
2 1989
Try

Me.Requery

in the main form's Current Event. The idea is to trap an event on the
main form when you make a change in the subform. Or another thing to
try would be to do a
me.Subform2.Requery (where Subform2 is your 2nd subform) - but you have
to trap the event in the first subform when you make a change. And one
more thing would be to trap the Current Event of the first Subform -
then you could do something like this:

Private Sub Form_Current()
Forms!your2ndSubform.Requery
End Sub

The main thing is to requery the Query when you change something on the
first subform.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #2
On Fri, 13 Jun 2008 08:17:04 -0700 (PDT), DeanL
<de*************@yahoo.comwrote:

Requery like Rick suggested may work, but I think there is a more
elegant solution. Recall that Excel recomputes formulas without you
having to click a recalc button. Access can do that too: it knows
which expressions depend on which ones, builds a tree and recomputes
without you asking for it.

In your situation I would put a textbox in the footer of subform1,
with a controlsource of:
=count(MyPrimaryKeyField)
Let's call this control txtCountOfRows

Then in the second subform you pick up that value:
=Me.Parent.MySubformControl1.Form.txtCountOfRows
This control will automatically show the new value if the rowcount in
subform1 changes.

-Tom.

>Hi everyone,

I have a subform in datasheet view that is used to display the
contents of a single table. I have another subform with a query
feeding it to give a count of how many particular items are in the
table and wanted to ask how I go about updating the count when I
delete a value from the datasheet subform without closing and
reopening the form?

Many thanks for any help you can offer...

Dean...
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
16969
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
2
8488
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
0
1911
by: Dalan | last post by:
I'm not certain if this is doable in the manner explained below, but I'm certain that there have been Access developers who have done something similar. So whatever insight and assistance that can...
13
4199
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a...
2
19548
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the...
2
1743
by: Ron | last post by:
Hi All, Okay, I've got a frmOrders with a subform of sfrmDetails. A frmClient has all the client info, plus a subform of sfrmDefaults that has the client's normal ordering defaults (like set...
4
3014
by: Swinky | last post by:
I am trying to make a combo box dependent on a text box. I cannot get the combo box to pull the related data from the text box. I have been all over this user group & have tried several versions...
16
34401
by: mlcampeau | last post by:
I'm fairly new to this so I'll try to be as clear as possible. I have a database that stores employee information and all job titles available. I have a main form that is based from a query and...
9
1743
by: Monroeski | last post by:
I have a form that has two subforms on it - one of them is continuous and lists a bunch of data about a given service's performance measures, while the other is a single view form where the user...
0
7039
marktang
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,...
0
7080
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4770
isladogs
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...
0
4476
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...
0
2977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1296
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 ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
176
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.