Greetings all, so obviously I am missing something. :banghead: I have a form in which I have placed a sub form table. For the purposes of this post, lets just run with the counting issue. So what I am attempting to do is to have the code count the number of records in the table. Please remember that this is a subform. The code moves through the DoCmd.GoToControl method with no problem. However when it gets to the DCount function it stops and tells be that the "tbl_ReqReview" does not exist and insists that I check the spelling. I know the table exists, I know the table is spelled correctly but it just won't move past that. :banghead: I have tried various combinations including "Forms!frm_Refill!tbl_ReqReview.Form" but to no avail. My only conclusion is that I am missing something in the actual name of the table.
It occurred to me
that the DCount is actually looking for a table as a dbase object instead of a part of a form, which leaves me back where I started
. Can anyone help determine how to count the number of records in a sub form table? I have used similar code in the past, so I know I'm on the right track but am having a hard time specifically identifying the actual table.
I saw a similar post to what I am attempting in another thread on this site, but the person never posted their final code so I am at a complete loss.
Thanks in advance for any help that you can provide.
It occurred to me


I saw a similar post to what I am attempting in another thread on this site, but the person never posted their final code so I am at a complete loss.
Code:
DoCmd.GoToControl ("tbl_ReqReview") 'Put the focus on the subform to enter data
Dim RecCount As Integer
RecCount = DCount("*", "tbl_ReqReview")
If RecCount < 1 Then
MsgBox "There are currently No Records to be viewed."
Cancel = True
End If