============================================================================
 LiteView2 — "An Access table managed by an HTML form" — Working Demo
============================================================================

Companion download for the tutorial:
  https://www.imranosoft.com/vba-javascript-bridge-tutorial.html

This is a complete, runnable Microsoft Access project that shows VBA and
JavaScript talking to each other through the WebView2 host-object bridge.
The Access form has no native controls — the entire UI is an HTML form
rendered by LiteView2, and it reads/writes a real Access table live.


WHAT'S IN THIS BUNDLE
---------------------------------------------------------------------------
  CustomerForm_Demo.accdb  The working database — open and run.
  LiteView2_x64.ocx         LiteView2 runtime (64-bit Office) — Reg-Free.
  LiteView2_x86.ocx         LiteView2 runtime (32-bit Office) — Reg-Free.
  README.txt                This file.

  The code already lives INSIDE the database — no loose copies are shipped:
    * VBA modules (frmCustomer + modLV2Pool):  open with Alt+F11 in the .accdb
    * The HTML form (dark & light themes):     table tblHTMLForms, field Form_HTML
    * Reading the code online? The tutorial shows every line:
        https://www.imranosoft.com/vba-javascript-bridge-tutorial.html


HOW TO RUN
---------------------------------------------------------------------------
  1. Extract ALL files into one folder. The .accdb and BOTH .ocx files must
     sit together — that is all Reg-Free needs (no admin rights, no regsvr32).
  2. Open CustomerForm_Demo.accdb in Microsoft Access (enable content if asked).
  3. Open the form "frmCustomers". The HTML form appears inside it.
  4. Navigate records (First / Prev / Next / Last), edit a field, click Save —
     the change is written straight to the "Customer" table. Try New and Delete.

  Everything you need is included; the OCX runs on a free 30-day trial. More:
        https://www.imranosoft.com/quickstart.html


HOW IT FITS TOGETHER
---------------------------------------------------------------------------
  * The HTML lives INSIDE the database, in table tblHTMLForms (column
    Form_HTML, Long Text), and is loaded with pool.NavigateToString — so the
    whole app ships as a single .accdb with no loose web files.
  * frmCustomer.vba registers the form as the host object "vba"
    (pool.AddHostObjectToScript). The page then calls your VBA functions:
        await vba.GetCurrentRecord()   -> reads the current row  (VBA -> page)
        await vba.MoveNext()           -> moves the DAO recordset
        await vba.SaveRecord(json)     -> writes the row          (page -> VBA)
  * JSON is the only thing crossing the bridge. The native engine builds it
    (pool.BuildJson) and reads it (pool.JsonGetValue) — no hand-written JSON.

  The tutorial walks through every one of these round-trips line by line.


ADAPT IT TO YOUR OWN TABLE
---------------------------------------------------------------------------
  VBA  — change four Consts at the top of frmCustomer:
           TBL, KEY_FIELD, SORT_FIELD, HTML_TABLE
         The save/load loops adapt to your columns automatically.
  HTML — replace the <input> fields in <div id="formArea"> with your columns
         (each id = "fld<ColumnName>") and list those names in the FIELDS
         array in the <script>. The JavaScript logic never changes.

  The page is table-agnostic: the VBA sends the primary-key column name as
  "__key", so the HTML never hardcodes "CustomerID".


NOTE ON THE STORED COPY
---------------------------------------------------------------------------
  tblHTMLForms holds a COPY of the .html file. If you edit the .html during
  development, re-paste it into Form_HTML — otherwise the form keeps showing
  the old page. (Most common "I changed the page but nothing changed" gotcha.)

---------------------------------------------------------------------------
 (c) 2026 LiteView2 — imranosoft.com — imran@imranosoft.com
