I am trying to develop a spreadsheet that can locate corresponding records in an external data source. So, let\'s say I have Column A with a list of identity values. I wan
So to do this I would create a UDF and have the backend of that function connecting to your access database. Something like this:
Public Function countMyTable(IDValue As Double) As Long
'Requires:// Microsoft Access 16.0 Object Library
'Requires:// Microsoft Office 16.0 Access database engine Object Library
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = Access.DBEngine.Workspaces(0).OpenDatabase(DBFilePath, False, False)
Set rs = db.OpenRecordset("SELECT COUNT(1) FROM MyTable WHERE IDValue = " & IDValue, dbOpenSnapshot)
rs.MoveLast
countMyTable = rs(0)
db.close
End Function
Hope this helps, TheSilkCode