简体   繁体   中英

How to count the number of entries under one field heading in database?

I have a database in Microsoft access and I would like to count how many entries are under a single heading in the database heading and then assign it to an integer so that I know how many times I need to run a loop further on in the code. I am using VB language.

to Count one uses an Aggregate query. This is an embedded feature of the Access product. When in query design mode look for the Sigma icon (like a big E) - and be sure to review some online tutorials on this topic.

In general, looping code is not used in database applications. Instead one uses record set queries. For example to change a value from X to Y - one uses a Select Query to first define the records that are to be changed. Then one uses an Update Query to change the value in those records. This method runs very very fast where a loop code approach will be very very slow if the record count begins to get large.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM