I have a lot of virtually identical functions that are used in several different places. These go to a recordset and count the number of records where a particular field is blank. I am trying to make one single generic function within a module that takes as arguments (1) the name of the recordset as a string either as a query or an SQL statement and (2) the field name to be used.
I can set up the recordset from the passed recordset string , e.g. Set rs = db.OpenRecordset(name of query), but I run into a problem when I want to use the field name. The line that causes me a problem is in the form:
If rs!fieldname = “” then …
I can’t see how I can substitute a variable for the name of an actual field. What is the syntax that allows me to do this? I’ve tried but failed to use Eval although that may be because of incorrect syntax.