I am trying to get the record count from a table. I want the table name to come from the filename that the user inputs into the form. The code I am using at the moment is:
tblname = Me.filename
totrec = DCount("*", tblname)
Me.TotalRec = totrec
But it throws an error, saying I entered an invalid argument.
I've seen it written like this on another database so not sure why it isn't working!
If I manually put the table name into it like so:
totrec = DCount("*", "TEST")
Then it works fine. I just need to how to put the tablename from the form into it.
Thanks alot
tblname = Me.filename
totrec = DCount("*", tblname)
Me.TotalRec = totrec
But it throws an error, saying I entered an invalid argument.
I've seen it written like this on another database so not sure why it isn't working!
If I manually put the table name into it like so:
totrec = DCount("*", "TEST")
Then it works fine. I just need to how to put the tablename from the form into it.
Thanks alot