Link to home
Start Free TrialLog in
Avatar of GNOVAK
GNOVAKFlag for United States of America

asked on

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?

Signed,
Loosing hair by the handfull.
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GNOVAK

ASKER

That was excellent - !
Do you have any animation on the splash screen? i.e. scrolling text or anything?
Avatar of GNOVAK

ASKER

Simple & Elegant.
Excellent. Thanks
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.
Avatar of GNOVAK

ASKER

any preference on Progress Bar?
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.
Avatar of GNOVAK

ASKER

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?
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.
Avatar of GNOVAK

ASKER

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?
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.

Form_frm_Status.CloseForm
Avatar of GNOVAK

ASKER

thanks,
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?
Avatar of GNOVAK

ASKER

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...?
Avatar of GNOVAK

ASKER

I hate 2010.
I'm testing. Latest theory is that when vba window is open, it errors. When closed there is no error.
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
    rs.movelast
    intRecCount = rs.recordcount
    rs.movefirst
endif
Do while not rs.eof
     'link table
     intCounter = intCounter + 1
     form_frm_Status.StatusUpdate PctComplete := intCounter/ intRecCount
     rs.movenext
Loop
form_frm_Status.Closeform

ProcExit:
rs.close
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