By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,510 Members | 1,437 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,510 IT Pros & Developers. It's quick & easy.

How to get form to display first, then run code on open?

P: n/a
I have a popup form that has Start and Stop buttons to initiate a search for
email messages. If the user's Inbox has thousands of messages, the Stop
button will gracefully end the search without making the user wait for the
search to complete. The form has an option to "start searching when form
opens", so the user can take the default search parameters and start the
search without having to click the Start button.

The problem is the form does not display until the search is complete. So
the stop button is not available and users are left staring at an hourglass
as the search runs.

I've tried this:

Private Sub Form_Load()
If m_blnSearchOnOpen Then
DoEvents
Call cmdStart_Click
End If
End Sub

but no luck.

How can I get the form to display first, then run the code behind the start
button?

Thanks in advance.

Jan 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Tue, 24 Jan 2006 19:20:12 -0800, "deko" <de**@nospam.com> wrote:
I have a popup form that has Start and Stop buttons to initiate a search for
email messages. If the user's Inbox has thousands of messages, the Stop
button will gracefully end the search without making the user wait for the
search to complete. The form has an option to "start searching when form
opens", so the user can take the default search parameters and start the
search without having to click the Start button.

The problem is the form does not display until the search is complete. So
the stop button is not available and users are left staring at an hourglass
as the search runs.

I've tried this:

Private Sub Form_Load()
If m_blnSearchOnOpen Then
DoEvents
Call cmdStart_Click
End If
End Sub

but no luck.

How can I get the form to display first, then run the code behind the start
button?

Thanks in advance.


In the Open event put the following lines.

DoCmd.SelectObject acForm, Me.Name
Me.Repaint
DoEvents

Wayne Gillespie
Gosford NSW Australia
Jan 25 '06 #2

P: n/a
> In the Open event put the following lines.

DoCmd.SelectObject acForm, Me.Name
Me.Repaint
DoEvents


That did the trick! Thanks!

I love simple solutions...
Jan 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.