Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Msgbox message not appearing

Status
Not open for further replies.

muhaidib

Programmer
Sep 27, 2005
82
SA
I am facing a strange problem. A simple code like: msgbox "The process is over" in procedure does not yield results during runtime in one computer but works well in another computer. The statement gives result in procedure of command1_click() in both the computers. Both the computers are with OS Windows XP Professional with SP2.

I could not guess the reason. Looking out for help.
 
Do you have error handling in your procedure?

eg.
Private/Public SomeSub()
On Error Go To TheEnd
Do some work here
Do other work here
'error
Other Work Here Generates Error on one machine
msgbox ""
TheEnd:
Error.Clear
End Sub

While you don't have to give the exact code, a better representation or explanation may be in order.

 
Dear vb5prgmr,
Hope following my code structure will help to analyze,

Private Sub cmdCreate_Click()
On Error GoTo ErrHandler
dim flag as integer

' some code here

if flag = 1 then
procedureA(flag)
msgbox "Results OK - " & flag
elseif flag = 2 then
procedureA(flag)
msgbox "Results OK - " & flag
elseif flag = 3 then
procedureA(flag)
msgbox "Results OK - " & flag
endif

Exit Sub
ErrHandler:
MsgBox Err.Number & " - " & Err.Description
End Sub

***********************

Private Sub procedureA(Flag As Integer)
On Error GoTo ErrHandler
' following not being printed
msgbox "Message from procedure - " & Flag

' some code here

Exit Sub

ErrHandler:
MsgBox Err.Number & " - " & Err.Description
End Sub
 
Ok, I see what may be happening and you can test this easily with some temporary code...

Code:
...
elseif flag = 3 then
   procedureA(flag)
   msgbox "Results OK - " & flag [blue]
else
   msgbox "Results NOT OK - " & flag[/blue]
endif
 
Answer to off topic:

Promotion/Project completion/Managerial changes/Promotions/Company changes/side work

All this and more can keep one very busy especially in these economic times.

End Answer to off topic:
 
Well, Welcome back vb5prgrmr!

muhaidib, It does looks like some other condition is slipping through, as vb5prgrmr has posted, and not because the MsgBox just isn't showing because of some MsgBox/OS/VB problem....
 
I think it's safe to say nothing is wrong with the MsgBox function.

The code is simply not getting to the MsgBox line. The Flag variable has not been set.

Error is somewhere in the 'some code here part.

Joe Schwarz
Custom Software Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top