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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Msgbox without X ? 1

Status
Not open for further replies.

BobJacksonNCI

Technical User
Mar 11, 2003
725
US
I'd like to be able to create a msgbox that does not have an X...

The reason is that an update is run after the User selects OK. If they select the X, the update doesn't run - and problems result.

Is that possible?
 
Why not create a popup form instead of using the message box. That way you can remove the "x" and force the user to close it properly. When you open the form, use acDialogue mode to prevent other code from running until the form is closed.

Randy
 
Please ignore - issue had to do with variables used to avoid User X'ing out of the database and not the msgbox in question.
 
BobJacksonNCI

I have seen code for creating your own text box involving creating a form with a modal property.

But you do have two other alternatives...
Have your msgbox appear in a a loop. Until the exiting condition is met, the msgbox keeps displaying.

Code:
Dim intAns As Integer, booNotOK As Boolean, strMSG as String
booNotOK = True
strMSG = "Is this what you want?" & vbCrLf & "Select YES or NO"

Do While booNotOK

    intAns = MsgBox(strMSG, vbYesNoCancel)
    
    Select Case intAns
        Case vbYes
            booNotOK = False
            ' your YES action
        Case vbNo
            booNotOK = False
            ' your NO action
    End Select

Loop

Two things...
- the "X" and Cancel are the same
- By using vbYesNo, the "X" is grey'd out (which was your original post) ... meaning that you can use vbYesNo by itself.

Richard
 
willir,

I'm still sorting the logic and don't think I need to look at the msgbox anymore.

However, your speedy response and timely information IS appreciated - a star for you.

Thanks!
Bob

randy700, your response is useful, too. It's just that I had that process in the back of my mind already.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top