• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1723
  • Last Modified:

Access 2010: Splash Screen - where to place code in background

I'm using Access 2010 and a MDB.  
I have a login form that when the user completes successfully,  calls a Splash Screen . I have to link a bunch of tables which may take a little time. I want the splash screen to stay up while this is done and then the form closes and a switchboard type form opens
The form just has a header and an embeded picture on it. No controls.
I have all control boxes off with no border.

I've been around and around on this.  I first tried putting the link code in the LOAD, but of course, it links, then goes directly to the switchboard.
I tried placing the code in the Activate and Got Focus events (along with a msgbox to see if it fires) and it doesnt.

So I thought I would create another form frmOpeningInvisible and place the code in that form. I could call frmOpeningINvisible from my splashscreen. But I run into the same problem - where to place things.

I then tried placing a text box (both visible and invisible) on the Splash Screen thinking that would trigger a form Activate. Nope.
The text box gets focus before the form is displayed.

Where do I place the code?
Should I place it on another, invisible form and if so, where do I call that form?

Loosing hair by the handfull.
  • 8
  • 6
1 Solution
Dale FyeCommented:
I generally put it in the Timer event of my splash screen.  I set the forms timer interval to 100, and then in the TimerEvent, I set that value [TimerInterval] to zero as the first line of code.  Then call my relinking code form there.
GNOVAKAuthor Commented:
That was excellent - !
Do you have any animation on the splash screen? i.e. scrolling text or anything?
GNOVAKAuthor Commented:
Simple & Elegant.
Excellent. Thanks
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Dale FyeCommented:
If there is a lot of linking to do, i will sometimes use a progress bar, but generally that process is so short, I just display a message in a label on the Splash Screen and display the hourglass until the linking is complete.  I'm more likely to use the progress bar when making connections to a SQL Server not located on a local server.
GNOVAKAuthor Commented:
any preference on Progress Bar?
Dale FyeCommented:
I use the one I describe in the article referenced in my previous post.  I developed that form several years ago, and have used it relatively consistently.
GNOVAKAuthor Commented:
The status bar is Great!
I'm having a problem though - in my 2010 app, it comes up as full screen and I cant seem to manipulate it to be a smaller window. I just brought over the form from the example as is.
Any clue?
Dale FyeCommented:
No, have not had an opportunity to use it in 2010.  Do you have your forms set up to display in tabs, or in overlapping windows?  I always use overlapping windows.
GNOVAKAuthor Commented:
Fyed -
Got it to work. Had to make it popup and then had to do the usual fix the screen size and then set the autosize to NO.

I have only one other problem, if you would be so kind.
I'm trying to eliminate the Continue button that appears. I just want the form to close.

I've changed a few things around, with no success. The only effect was that now, after 100% (it seems) I get an application undefined  or object undefined error. I (think) its from that form but not 100% sure. I cant seem to trace it no matter where I put the stops.  That leads me to believe that its in the timer event.
I tried using the original and get the same
I take the call to the form out and the error goes away.

Any idea?
Dale FyeCommented:
In a slightly newer version of that code I added a Public sub to frm_Status
Public Sub CloseForm()

    On Error Resume Next
    DoCmd.Close acForm, Me.Name
End Sub

Open in new window

and I simply call it at the end of my loop to bypass the Continue.

GNOVAKAuthor Commented:
When you say "end of my loop" - do you mean after linkage loop in the external form that calls the PBar?

 but I still have two issues -
1) the form seems to "hold" there after it reaches 100%. I took out the pause with little effect
2) Big one - I get the Application defined or object-defined error.

I call a splash screen that has a timer set that calls an Invisible form. The invisible form calls my LINK TABLES sub. This links Oracle tables using ODBC.  This works great UNTIL I place the progress bar in. I have also tried to go directly to the Invisible Screen.  The problem still occurs - Application defined or object defined error.  

Any idea?
GNOVAKAuthor Commented:
I just put an error routine in the StatusUpdate. It captured a 2467 error - the expression you entered refers to an object that is closed or doesnt exist.
What's interesting is that it does it after a relatively long run of linking tables, but not always at the same spot or same %. My gut is saying that since the Oracle links can be sporadic in the time it takes, the linkage takes a little extra time after 21 or 22 tables, hiccoups, and this causes the status bar to hiccough.
But how to correct...?
GNOVAKAuthor Commented:
I hate 2010.
I'm testing. Latest theory is that when vba window is open, it errors. When closed there is no error.
Dale FyeCommented:
I have not done extensive testing of the status bar in 2010.  It was originally written in A2003, and converted to 2007.  I have a client with a of 2007 apps working on computers running 2010 and have not received any messages from them about problems.

As indicated in the example, I usually do something like:

Form_frm_Status.StatusUpdate "Linking tables", 0
set rs = db.openrecordset("qryLinkedTables")
if not rs.eof then
    intRecCount = rs.recordcount
Do while not rs.eof
     'link table
     intCounter = intCounter + 1
     form_frm_Status.StatusUpdate PctComplete := intCounter/ intRecCount

set rs = nothing
Exit Sub

Then, I make sure my error handler in that procedure includes:

If currentproject.allforms("frm_Status").isloaded then form_frm_Status.closeform
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now