"#type!" error on report calculated field

Kai picture Kai · Oct 31, 2013 · Viewed 51.8k times · Source

I have a report in Access with 3 fields on it: Width, Height and Area.
Width and Height are pulled from the table the report is bound to, whilst Area should be calculated (height * width). I've set the Control Source of the Area to = [Height] * [Width], but on opening the form the field displays #Type!, in typically descriptive Access errors fashion, with nice use of # and ! to make it impossible to accurately Google... but I digress. I have no idea what #Type! means and Access doesn't want to tell me.

I can't understand this. In the bound table, Height and Width are Integers, and are both populated in the record being viewed (so it's not a NULL problem). If I change the Control Source to something really simple - like =[Height], it spits out #Error! instead (again, thanks for the useful intel, Access. We'd be lost without you). Even = 1 spits out #Error!.

Any idea why Access hates my control sources?

Answer

Chris Rolliston picture Chris Rolliston · Oct 31, 2013

You probably have a name clash, i.e. Access is picking up the Width and Height members of the report object rather than the fields called Width and Height.

I would create a new query and simply rename the problematic fields in it. So, if you're using the query designer:

  • add the primary key and any other non-problematic field, then WidthValue: Width and HeightValue: Height as additional columns;
  • finally, set the report's record source to be the query rather than the table directly, and update the calculated control formulae accordingly.