0

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

1 Answers1

2

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"
4dmonster
  • 3,012
  • 1
  • 14
  • 24
  • Na, I did try OnOpen, it needs to be earlier than that sadly –  Oct 09 '13 at 11:52
  • 2
    so in design view set RecordSource empty and assign sql after table creation – 4dmonster Oct 09 '13 at 11:56
  • Record source is already empty? I don't understand what you mean, I just need to be able to call some code before anything is actually ran –  Oct 09 '13 at 12:11
  • I suppose, problem is not in event order the form itself can't be opened with wrong RecordSource. – 4dmonster Oct 09 '13 at 12:14
  • Wasn't EXACTLY the answer, but I got through it by setting the record source of the form after I created the table, so close enough, thanks for the information –  Oct 09 '13 at 12:37