Table of Contents

VBC09334 — Access not valid for the file mode

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

The Access clause of an Open statement is not one that the For mode of the statement allows.

MS-VBAL §5.4.5.1 Open Statement states the rule and names no error: the message is the platform's.

This code is raised by FileStatementStaticSemantics.

How it is raised

Situation Example Resolution
Output has an access other than Write. Open f For Output Access Read As #1 Write, or open the file For Input.
Input has an access other than Read. Open f For Input Access Write As #1 Read, or open the file For Output.
Append has an access other than Read Write or Write. Open f For Append Access Read As #1 Use Write or Read Write.

Notes

Random and Binary allow any access. With no Access clause, the access is the one the mode implies, and there is nothing to be wrong.

See also


⏮️ VBC09333 Variable required | ⏭️ Diagnostics


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