Count - Ms access update Query

MUKESHY12390

Well-known Member
Joined
Sep 18, 2012
Messages
901
Office Version
  1. 2013
  2. 2011
  3. 2010
  4. 2007
Platform
  1. Windows
Hi All,


I have two field ID and Frequency, I am to trying to create update query so that I can get "ID" count in "Frequency" field.

Is there anyway I can do it in access by running update query.


BS,
Mukesh Y
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
This isn't something you would normally store in the database, you would normally calculate it at run time. If you store it and then someone adds a record your data would then be incorrect... unless you need the count at a specific point in time.

The query to view the data would be:

Code:
SELECT ID, Count(ID) AS Frequency FROM [I]MyTable [/I]GROUP BY ID

If you need to store it (not sure why you would, but if you do) one way is using Dcount:

Code:
UPDATE MyTable SET MyTable.Frequency = DCount("*","MyTable","ID = " & [MyTable].[ID])

depending on size of table it may be quicker running a make table query and using that in an update query.
 
Upvote 0
Thanks Stumac. I just realized using Dcount slow down the whole process.

make table query and using that in an update query.

this works perfectly I wanted.
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,327
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top