Solved

Using DCOUNT in Continuous SubForm (or similar)

Posted on 2014-02-26
4
703 Views
Last Modified: 2014-03-04
Hi,

I have a continuous subform that has a text field in it.  This text field is set to ;
=DCount("[CustomerNumber]", "tblOrders", "[CustomerNumber] = 888")


The DCOUNT bit works fine!

However,  for example, if there are 4 records shown in the continuous form then ALL of them have there text field updated.

I (obviously) ONLY want ONE record of the sub form updated.  I.e. the record that I have just amended.

Perhaps, you have seen this issue before?
0
Comment
Question by:Patrick O'Dea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 37

Assisted Solution

by:PatHartman
PatHartman earned 250 total points
ID: 39889219
Access maintains only a single set of form properties.  That is why in a continuous or datasheet view, all instances of an unbound control show the same value.

We need to know more about what you are trying to count to advise further.  It is possible to use DCount() in a query although I don't recommend it.  If you use it in the query, you will be able to bind the control to a column from the query and so each row can show a different value.
0
 

Author Comment

by:Patrick O'Dea
ID: 39889928
Thanks for the help so far.

I attach a simple example.

1. There are 4 cities in tblCity.

2. I am monitoring cars (!) in the city.  I am writing the registration plate of each car seen in the city.  These registration numbers are help in tblCarsSpotted.

3. You will note that car reg L999 J120 has been seen in more than one city!

4. I want to see in the yellow box the NUMBER of cities that each car has been seen.

5. For example, the number 3 should appear in the yellow box for every occurrence of registration L999 J120.


How do I achieve item number 5?
CarsTemp.accdb
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 total points
ID: 39901044
Working from iPad, so cannot open your file.

Does the resulting recordset (the one shown in your continuous form) need to be updateable?

If not you could create a subquery:

SELECT [Registration], COUNT([City]) as CitiesSeenIn
FROM (SELECT DISTINCT [Registration], [City] FROM tblCarsSpotted) as DistinctSpotings

And then join this to your Cars table on the Registration field.
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 39904745
Thanks folks.
I have decided not to use this function after all.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question