Access with breaking changes on Version 2206 (Recordset2.Fields returns DAO.Field3 instead of DAO.Field2) - Error 13

Viewed 432

It looks like Microsoft introduced a breaking change with version 2206! :-(

If you had code like

Dim rs as DAO.Recordset2
Dim fld as DAO.Field2

For Each fld in rs.Fields   '<- Code will break here, because Fields suddenly return Field3
   ... 
Next

This is a nightmare! I can confirm that reverting to Version 2205 fixes the problem.

My questions:

  • Has anybody an idea of how to fix the problem? (other than changing all the code)
  • Anybody with some contact to MS to fix the mess?

Thanks for any help!

Object browser for V 2205Object browser for V 2206

1 Answers

From MS:

The simplest workaround for now is to change declarations of type DAO.Field2 to DAO.Field.

Field2 was added to support properties for multi-valued fields, Field3 was added to support the Precision and Scale properties for decimal types. (You’ll note that there is also a Recordset2 object in the browser, for similar reasons).

You don’t get intellisense for the extended properties if you declare as ‘Field’, but you can still access all the properties in code.

When we make an update to an interface, we can’t update the existing interface, but must extend the existing interface. We are looking into whether we can improve the backward compatibility issue for cases where people explicitly declared variables to be of type Field2, rather than just Field.

Related