Function to return number of records in table

Challseus

Board Regular
Joined
Feb 5, 2003
Messages
141
Hi all: Having some problems again that just aren't making sense to me. I'm looking for a function that will return the number of records in a table or form. I type in the name of the table/form followed by ".", but I don't see and numRecs function or anything like the sort.

The reason I need this is so when I display a form, I want it to automatically go the last page. Now, maybe there's even function that will do that for me, I don't know, but I know there has to be a function that returns the record count, not sure why I can't find it.

Now that I think about it (sorry for rambling), is there a function that will return the index of the record you are in. That would help out a lot as well. I know it seems like I'm lazy, but I don't have the CD to install help files and I cant seem to find the anwers anywhere else. Any help is much appreciated.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Sorry, maybe I wasn't specific enough. I apologize. Is there any way to get to a blank record?

Let me break my dilema real quick before I leave work:
The user will be filling out 1 from the has 4 fields (name, add, phone, etc).
If the name they type isn't in a table that I query, then I want to show the form that can enter in new info. That part is working fine. This is basically cosmetic, but I just want the first record shown when they are prompted to fill in new info to be empty. Hoep this helps a little more.
 
Upvote 0
Yes, same syntax.

DoCmd.GoToRecord , , acNewRec

If you still need to count the number of records in a table, you can open it in a recordset and look at the GetRows property. There's probably another more direct method though.

Mike
 
Upvote 0

Forum statistics

Threads
1,221,543
Messages
6,160,421
Members
451,644
Latest member
hglymph

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