Search code examples
vbaeventsms-accesstemp-tables

How to load code before on form load


I have some code I need to load in before I want the code to run (I want to create a table), I tried 'Onload' but this is not soon enough, basically I'm looking for something just like OnInit() where I can load all I need before anything actually occurs. My problem is that it's checking for the table way to early (Because it hasn't been created yet)

http://gyazo.com/c731783b9b2a01dcaf93f92a170f61ba

So really I just need some help with calling code before the actual onLoad event is called.

THanks


Solution

  • Is OnOpen event suitable?

    And you can have empty RecordSource in form and set it after you have created table. 1. open form in design view 2. copy RecordSource 3. in you event(onOped or onLoad) put after table creation code

    Me.RecordSource = "COPY'ed recordsource"