Table of Contents

VBC09321 — Argument required for Property Let or Property Set

Severity: Error  ·  Family: VBC (static semantics / abstract syntax tree)  ·  Source metadata: VBCompileErrorInfo

A Property Let or Property Set declares no parameters at all, so it has no value parameter to receive what is being assigned.

MS-VBAL §5.3.1.5 Parameter Lists gives property-parameters = "(" [parameter-list ","] value-param ")". In this rule value-param is never bracketed, so it is always mandatory, index parameters or not.

This code is raised by ScopeTreeSymbolResolver, ahead of and instead of VBC09320, as soon as a name resolves to a Property Let/Set with an empty parameter list. A lone accessor is checked in the same way as one paired with a Get.

The verbose detail lists the offending accessor declaration.

How it is raised

Situation Example Resolution
A Property Let with no parameters. Property Let Foo() Add the value parameter: Property Let Foo(value As Long).
A Property Set with no parameters. Property Set Foo() Add the value parameter: Property Set Foo(value As Object).
A Property Let/Set with no parameters, paired with a valid Get. Property Get Foo() As Long next to Property Let Foo() Add the value parameter. The missing value parameter is reported even though the Get accessor is valid.

Notes

A Property Get needs no value parameter: it has no value being assigned to it, only (optionally) index parameters to read by. This code never applies to one.

Compare VBC09320, which applies only when at least two accessors are present, and compares their index parameters or value types. This code is also raised for a single accessor, because a Property Let/Set with an empty parameter list is invalid on its own, whether or not it collides with anything else.

See also


⏮️ VBC09320 Inconsistent property accessors | ⏭️ VBC09322 Event not defined


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca