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

Form Not Painted / Visible !

P: n/a
I have a msgbox in my form activate event with an OK button.

However the msgbox shows up BEFORE the form is painted.

I would like the msgbox to be visible after the form gets painted on
screen.

Is there any way I can do that from the Activate event ?

I know that if I place my code in the curent event it will work, but
this code will fire for each record navigated.

Thx & Best Rgds,
Prakash.

Nov 13 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On 25 Jul 2005 02:02:24 -0700, "Prakash" <si****@omantel.net.om>
wrote:

This may be one of the few good reasons for a well-placed DoEvents
call. Put it just before the MsgBox call.

-Tom.
I have a msgbox in my form activate event with an OK button.

However the msgbox shows up BEFORE the form is painted.

I would like the msgbox to be visible after the form gets painted on
screen.

Is there any way I can do that from the Activate event ?

I know that if I place my code in the curent event it will work, but
this code will fire for each record navigated.

Thx & Best Rgds,
Prakash.


Nov 13 '05 #2

P: n/a
how about using "OnLoad"?

Nov 13 '05 #3

P: n/a
I should have mentioned I guess:

I did try a DoEvents ... does'nt work.

OnLoad is no use because the order of Form Events (while opening) is:
Open → Load → Resize → Activate → Current

Any ideas anyone ?? How can we force a form to finish drawing
(becoming 100% visible) before the Curent Event is activated ?

Thx & Best Rgds,
Prakash.

Nov 13 '05 #4

P: n/a
Prakash wrote:
I should have mentioned I guess:

I did try a DoEvents ... does'nt work.

OnLoad is no use because the order of Form Events (while opening) is:
Open → Load → Resize → Activate → Current

Any ideas anyone ?? How can we force a form to finish drawing
(becoming 100% visible) before the Curent Event is activated ?

Thx & Best Rgds,
Prakash.

Not tested, but how about a form level variable, say:

Dim booMsgDisplay as Boolean

In the on open event, have a line:

booMsgDisplay = True

Now put an if statement with your on current event.

If booMsgDisplay = True then

Msgbox "blah, blah, blah and how are you today?"

booMsgDisplay = false

end if

booMsgDisplay will then be false and the msgbox won't go off until the
form is closed and then opened again.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #5

P: n/a
On 25 Jul 2005 06:52:09 -0700, "Prakash" <si****@omantel.net.om>
wrote:

One solution may be to tick a 1 msec timer in OnLoad, and in the Timer
event turn the timer off and display your message.

-Tom.

I should have mentioned I guess:

I did try a DoEvents ... does'nt work.

OnLoad is no use because the order of Form Events (while opening) is:
Open ? Load ? Resize ? Activate ? Current

Any ideas anyone ?? How can we force a form to finish drawing
(becoming 100% visible) before the Curent Event is activated ?

Thx & Best Rgds,
Prakash.


Nov 13 '05 #6

P: n/a
er, i think we may have misunderstood the problem a bit.

The message box is visible ... but BEFORE the form gets painted.

I'd like the form to first get painted & then the msgbox to be visible
.... because there is a column of data in the form which is populated
with incorrect values & I'd like the user to be able to see that column
behind the msgbox.

Then when the user clicks ok to close the msgbox, the column gets
populated with the correct values.


Private Sub Form_Activate()
Dim msg As String, msg1 As String, msg2 As String

Me.Repaint
DoEvents
MsgBox "Form Activated"

'If any SUB_TRAN_NO has a "ZERO" value, Re-Number all the Rows with
new STN values
If Nz(DMin("[SUB_TRAN_NO]", "JV_Edit_Delete")) = 0 Then
msg1 = "Sub-Transaction Numbers Not Proper !"
msg2 = "Rows will be Re-Numbered !"
msg = msg1 + Chr(10) + Chr(10) + msg2
MsgBox msg, vbOKOnly + vbInformation, "Message..."
Call Cmd_ReNumber_Click 'Re-Number the sub_tran_no field
End If

End Sub
Hoping something is visible to you'll I may have missed.

Thx & Best Rgds,
Prakash.

Nov 13 '05 #7

P: n/a
Option Compare Database
Option Explicit

Dim txtSW As String

Private Sub Form_Activate()
If txtSW = "L" Then
txtSW = " "
Else
MsgBox "this is the message 1", 48
End If
End Sub

Private Sub Form_Open(Cancel As Integer)
txtSW = "L"
End Sub
You didn't say if you wanted this to dislpay when the form is
opened the first time.

You can also put your code in the GotFocus event of the first
control on the form and test by setting a switch in the
OnActivate event of the form to see if the user came from another
form or another control back to the first control.

Ron

Prakash wrote:
er, i think we may have misunderstood the problem a bit.

The message box is visible ... but BEFORE the form gets painted.

I'd like the form to first get painted & then the msgbox to be visible
... because there is a column of data in the form which is populated
with incorrect values & I'd like the user to be able to see that column
behind the msgbox.

Then when the user clicks ok to close the msgbox, the column gets
populated with the correct values.


Private Sub Form_Activate()
Dim msg As String, msg1 As String, msg2 As String

Me.Repaint
DoEvents
MsgBox "Form Activated"

'If any SUB_TRAN_NO has a "ZERO" value, Re-Number all the Rows with
new STN values
If Nz(DMin("[SUB_TRAN_NO]", "JV_Edit_Delete")) = 0 Then
msg1 = "Sub-Transaction Numbers Not Proper !"
msg2 = "Rows will be Re-Numbered !"
msg = msg1 + Chr(10) + Chr(10) + msg2
MsgBox msg, vbOKOnly + vbInformation, "Message..."
Call Cmd_ReNumber_Click 'Re-Number the sub_tran_no field
End If

End Sub
Hoping something is visible to you'll I may have missed.

Thx & Best Rgds,
Prakash.


Nov 13 '05 #8

P: n/a
Thx Ron !

Sorry if I was a tad ambiguous.
Rgds,
Prakash.

Nov 13 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.