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

Hide and Seek with Message Boxes

Expert 100+
P: 1,221
Cheers, everyone. Thanks in advance for any help you can offer.

Sometimes my Access program appears to lock up. The user is sitting there, waiting for something to happen after they hit a button, and nothing happens. If they have their speakers turned on, they hear a "bonk."

What's really happening is that the program attempted to display a message box and the message box window is hiding behind another window. If you happen to do an Alt/Tab, then suddenly you see there's this message box waiting for you to click the "okay" button.

I can't see any rhyme or reason to it. Often the message box appears as it should, then a minute later, the same button press is done and the message box does not appear, we just hear the "bonk" sound the message box gives.

What causes this and what can I do about it?

Thanks,
Jim
Oct 14 '06 #1
Share this Question
Share on Google+
4 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
What code is appearing after the code to display the message box. It sounds like something else is subsequently getting focus. Does the message box have a vbOK button on it?



Cheers, everyone. Thanks in advance for any help you can offer.

Sometimes my Access program appears to lock up. The user is sitting there, waiting for something to happen after they hit a button, and nothing happens. If they have their speakers turned on, they hear a "bonk."

What's really happening is that the program attempted to display a message box and the message box window is hiding behind another window. If you happen to do an Alt/Tab, then suddenly you see there's this message box waiting for you to click the "okay" button.

I can't see any rhyme or reason to it. Often the message box appears as it should, then a minute later, the same button press is done and the message box does not appear, we just hear the "bonk" sound the message box gives.

What causes this and what can I do about it?

Thanks,
Jim
Oct 14 '06 #2

Expert 100+
P: 1,221
Here is a typical example of a button that sometimes hides the message box widnow ...
Expand|Select|Wrap|Line Numbers
  1. Private Sub btn_ConfirmOrder_Click()
  2.     Dim byteResponse As Byte
  3.     byteResponse = MsgBox("Confirm Order", vbOKCancel, "Confirm Order")
  4.     If byteResponse = vbCancel Then GoTo endroutine
  5.  
  6.     Dim db As Database
  7.     Dim rs As DAO.Recordset
  8.  
  9.     Set db = CurrentDb
  10.     Dim str_tempPONumber As Variant
  11.  
  12.     str_tempPONumber = Me!txt_OHPONumber  '
  13.     If Len(str_tempPONumber) < 1 Then GoTo Err_NoPONumber
  14.     If (str_tempPONumber = Null) Then GoTo Err_NoPONumber
  15.  
  16.     Set rs = db.OpenRecordset("tbl_OrderDetails")
  17.     On Error GoTo Loopend
  18.  
  19.     rs.MoveFirst
  20.  
  21. LoopItems:
  22.     ETC....
  23.  
Oct 14 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
I can't see any reason for your problem.

Msgboxes shouldn't lose focus. Make sure the users aren't doing anything strange.
Oct 14 '06 #4

Expert 100+
P: 1,221
The focus remains with the form that has the button being pushed, the event that leads to the message box being displayed. I wonder if this problem could be caused by what is going on in other objects on that form.

There are some text boxes with calculations and values from outside the form itself, likes quantity on hand for each item on the order form, that sort of thing ... so if somebody else ships another order with one of those items on it, the form should be updated because of that ... I'll try some things pertaining to that.

Thanks for your comments.

Jim
Oct 14 '06 #5

Post your reply

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