# AR-Reconciliation-Tool — VBA + Access Demo Sample

This is a **self-built demo sample**, created by our team to illustrate the legacy VBA +
MS Access architecture described in the Customer VBA System Transition MoM, and to
demonstrate TextIQ's ability to read VBA + Access source and generate a Detail Design
Document from it.

**This is not a real customer tool and is not sourced from any external open-source
project** — no open-source example of this exact architecture pattern exists, so we built
a small, representative one ourselves for the customer demo meeting.

## What it simulates

An "AR Reconciliation" tool matching branch transaction exports against bank statements —
one plausible example of the 8 tools the customer will operate.

```
Excel Input (Transactions_*.xlsx, BankStatement_*.xlsx)
        |
        v  (Import button)
Frontend.accdb  --- linked tables --->  Data_Backend.accdb  /  Data_Log.accdb
   (Forms + VBA)                          (raw data only, no UI/VBA)
        |
        v  (Export button)
Excel Output (ReconcileReport_<month>.xlsx)
```

## Contents

- `vba-source/` — VBA modules and class, as text (source of truth, version-controlled)
- `schema/` — Access table DDL + ER diagram
- `sample-data/` — fake Excel Input files with deliberate edge cases (duplicate ref,
  rounding variance, 1-day date shift, unmatched row)
- `forms-spec.md` — form/control layout spec used by the build script
- `build/` — `Build-AccessDemo.ps1` (Windows-only, requires MS Access) + build
  instructions + validator/generator scripts and their tests
- `generated-design-doc-sample.md` — **produced separately**, by running TextIQ's
  `textiq-explore-code` / `textiq-analyze-business` / `textiq-generate-docs` against
  `vba-source/` + `schema/` on the TextIQ side (see the design spec, Section 5, for the
  go/no-go checkpoint). Not generated by this repo's tooling.
- `demo-talk-track.md` — click-by-click script for the customer meeting

## Building it

This repo only contains text/data source. To get runnable `.accdb` files, follow
`build/README-build.md` on a Windows machine with MS Access installed. The built
`.accdb` files are intentionally **not committed to git** — regenerate them from source
anytime.

## Validating source consistency

Before building, or after changing any VBA/schema/forms-spec file, run:

```bash
python3 build/validate_sources.py
```

This checks that table names referenced in VBA match `schema/backend_schema.sql`, and
that every `Module.Proc` handler referenced in `forms-spec.md` actually exists in
`vba-source/`.

## Regenerating sample data

```bash
python3 build/generate_sample_data.py
```

Deterministic (fixed random seed) — regenerates the same 3 Excel Input files with the
same edge cases.
