473,419 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Unbound Form "AutoLoad" Event Issue

I have been asked to develop an application in Access for work. This application must have a simple user interface because the folks using it are not "database people" - their words, not mine.

One of the "screens" they want to see will display a progress bar. I created the "screen" in a form. I do not currently have it bound to any data because it is not intended to display any records. It's sole purpose is to show the progress bar (and some text describing what it's doing) while visual basic does some magic in the background.

Here is the issue I'm having. If I put my code into the onclick event of a button, everything works fine - exactly how I want it to.

If I put my code into the forms onload event, the code executes prior to the form being displayed - as expected, right? But we want to see the progress bar change as VBA does its deal. Because the form hasn't been displayed yet, you just wait until VBA is done, and then get the form displayed showing a full progress bar and text indicating that VBA is finished with its job. So onload is definitely not where I want the code. - Please note that the form actually hasn't displayed yet, so repainting the form won't help here.

But if I put the code into the forms onactivate event, nothing happens. The form is displayed, but the code never executes.

I understand that onload fires prior to the display of the form. onactivate supposedly fires after the form is displayed (and I guess it can fire after that too depending upon focus, etc.). But even if I put some very simple code in the onactivate event - like msgbox ("Hi there.") - , nothing happens.

I thought maybe the form had to have a record source for onactivate to fire, so I've tried actually binding the form to a record source, but it didn't help. Then I tried actually displaying a record from that record source on the form, but it didn't help. I simply can't seem to get the onactivate event to fire.

What am I missing? I'm sure it is something rediculously simple and I'll go ahead and apologize for being a big dummy. But I'm stumped and would really appreciate some help.

For now, I'm just going to make them click the button to get it all started until I get this thing figured out. Thanks in advance for helping to push back my ignorance!
Oct 12 '08 #1
4 2720
FishVal
2,653 Expert 2GB
Hello, Robert.

I suppose you should put your code in Timer event handler having set TimerInterval to let us say minimal value = 1ms.

Form will not be visible while all the following events are being handled.

Open
Load
Activate
Got focus
Current

Regards,
Fish
Oct 12 '08 #2
Hello Fish!

You know, it's amazing how we get caught up in "what we know" about how things work. I had originally dismissed the timer function because I was SURE that once I put something in the ontimer event, that it would continue to execute at the specified interval until the cows came home or the form was closed. I just assumed that setting the timer interval to zero would just repeatedly fire the code.

But your solution was perfect! I set the form's timer interval property to 50. It displays the form perfectly, then 50 ms later fires the code. The first line of the code sets the timer interval back to zero. And no matter how long the box stays open, the code only fires one time!

Outstanding. And I didn't even have to release my version with the command button!

I wonder how many other functions and events I "think" I know....

Thanks again!
Oct 12 '08 #3
FishVal
2,653 Expert 2GB
You are welcome.
Good luck.
Oct 12 '08 #4
NeoPa
32,556 Expert Mod 16PB
Nice one Fish.

I was intrigued, and did some testing. Open AND Load were both executed before the form was even visible. Yours is a clever solution to the problem :)
Oct 12 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Fan Ruo Xin | last post by:
Last monday, I tried to create a working table, and failed because of 'Log Full'. There were two applications running at that time - one is autoload (during the split phase), another one is "insert...
10
by: Luke Meyers | last post by:
So, just a little while ago I had this flash of insight. It occurred to me that, while of course in general there are very good reasons for the conventional two-file header/implementation...
5
by: lister | last post by:
Hi all, I have a fairly diverse range of data that I want to cache in the session rather than pulling it from the database on every page refresh. The problem is is that it seems that PHP...
4
by: CCHDGeek | last post by:
I have a form that opens when an Access 2003 database starts up. In the VBA for the form, I have a complex function that is copying files from various folders and updating several tables. But the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.