Building a Form to use intead a MsgBox standard window ! (1 Viewer)

alvingenius

IT Specialist
Local time
Today, 04:20
Joined
Jul 10, 2016
Messages
169
Hello
I know it sounds weird, but I'm trying to build a form to act as Messagebox; with it, it gives an excellent look instead of the standard message box window

I've tried the formatted messagebox in AttentionSeek db of @isladogs, and it's not giving a look that a specific form gives!

here's a demo of the form and the look I'm expecting vs standard msgbox

1670724067861.png


So, I'm trying to build a custom function to handle it and for the msgboxstyle I wanna use this cases
Code:
    Select Case vbMsgBoxStyle
        Case vbOKOnly
            frm_Messagebox.btnYesOk.Caption = "OK"
            frm_Messagebox.btnNo.Visible = False
        Case vbYesNo
            frm_Messagebox.btnYesOk.Caption = "Yes"
            frm_Messagebox.btnNo.Visible = True
        Case vbCritical
            ' Set the image control to the critical image.
            frm_Messagebox.imgCritical.Visible = True
            frm_Messagebox.imgInformation.Visible = False
        Case vbInformation
            ' Set the image control to the information image.
            frm_Messagebox.imgCritical.Visible = False
            frm_Messagebox.imgInformation.Visible = True
    End Select

and this function should use the same msgbox arguments of "prompt message", "Title", vbOkOnly, vbYesNo, vbInformation, vbCritical
and the user should call this function using "MsgboxFrm" instead of "Msgbox"
So the upper screenshot should be called via this code
Code:
MsgBoxFrm "Are you sure you want to delete this record?", vbCritical + vbYesNo, "Delete Confirmation"


I don't know how to proceed further.
Should it be built as a module, or should I use the Form that I made as message box on Form_load event !
how to get the message prompt and the title, and other msgboxstyles
how to detect what button the user clicked? how to pass this information to where I called the function to proceed with the actions related to the user choice (like how msgbox acts)

I wish I get help on this task, and I'm attaching the demo db that has the design of the form and the msgbox examples
 

Attachments

  • MessageBox.accdb
    540 KB · Views: 111

June7

AWF VIP
Local time
Yesterday, 18:20
Joined
Mar 9, 2014
Messages
5,463
Did you not simply install Colins table, form, and code into your db? You can modify his form for your style preferences.

I don't think the MsgBox constants will have any meaning to your message form. I am not sure what you are asking for with that question. You set textbox, button, and image controls with whatever info you want to display. After all, this is just a form.

You don't 'detect' what button user clicks, you use button Click event to process code.

Pass information between message form and another form same way as would with any two forms. There are several ways: Global variable, TempVar, setting value of a textbox, OpenArgs.

Which Form_Load event are you referencing?

About only reason I can see for going to all this trouble is if you have users with poor eyesight. I try hard to avoid use of popup MsgBox.
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:20
Joined
May 7, 2009
Messages
19,226

isladogs

MVP / VIP
Local time
Today, 03:20
Joined
Jan 14, 2017
Messages
18,207
As June said, I'm just wondering why you didn't adapt the customised message form examples from my article/example app

Yet another variation on this is the 'Modern Box' provided by Gustav Brock
 

Users who are viewing this thread

Top Bottom