I have reviewed the forums and I am fairly sure that my issue is that I do not know how to properly reference the access database and table table in my code.

My quest:

I want to be able to place a custom function in query that looks at a certain date field within the table and returns values based on what it sees. If I can get the below code to work, I will extrapolate to return about 15 different values based on what it finds in the "Duedate" field in "Tbl1." I am working within a VB module contained in the same access database that the table "tbl1" is stored.

Again, I believe where I am failing is the proper syntax for referencing the table and the field, and I believe making proper declarations. I know it must be simple but I am learning on my own and I cant find the answer.


VB Code:
  1. Public Function AgingCat()
  2. If Month(TBL1.DUEDATE) >= Month(Date) And Year(TBL1.DUEDATE) >= Year(Date) Then
  3. AgingCat = "CURRENT"
  4. End If
  5. End Function


Please help!