Messagebox Titles

A

Arturo

I use this code to present a messagebox when a control is clicked.

MsgBox "If the employee's wage changes, enter the amount" & Chr(10) &
Chr(10) & _
"and the date the wage changed. The employee's " & Chr(10) & Chr(10) & _
"employment record will be updated from here."

The messagebox title says "Microsoft Access." How do I
get my own title to show up. For example, "WAGE CHANGE."

Thank you.
 
D

Douglas J. Steele

Take a look in the Help file.

There are a few other parmeters available to you. You can specify what
buttons appear on the message box and what icon appears on it as the 2nd
parameter, and the caption for the message box as the 3rd parameter.
 
B

Beetle

The third argument in the MsgBox function allows you to input a
message title. For example;

MsgBox("Your message here", vbOKOnly, "Wage Change")
 
F

fredg

How changing the font to say, Times New Roman 12, or ?


Only if you change the master settings for the message box for ALL
Windows and Office Applications.
Right- click on a blank section of the Windows Desktop.
Select Properties + Appearance + Advanced.
Find the Message Box in the drop down.
Select your Font and Size. Save the changes.

I would suggest that rather than change the settings for all
applications, you create your own, unbound form to be used as a
message form.
Add a Label control and a Text control as well as 2 command buttons.
Name them cmdYes and cmdNo

You can set the font style, size, color, etc., however you wish.

Code the cmdYes button's click event:
TextControlName = 1
Me.Visible = False

Code the cmdNo click event:
TextControlName = 2
Me.Visible = False

You would then open the form, using:

Dim strMessage as String
strMessage = "This is your message"
DoCmd.OpenForm "MessageFormName", , , , , acDialog, strMessage

If forms!MessageFormName!TextControlName = 1 then
' Do the Yes thing
Else
'Do the No thing
End If

DoCmd.Close acForm,"MessageFormName"

Code the Load event of the message box form:
LabelName.Caption = Me.OpenArgs

When the form is opened processing waits (just like a MsgBox) until
you click either command button. Then the Yes or No action will be
taken and the form closed.
 
B

Beetle

If you want to do that, you're better off creating your own custom form
to use as a message box. Thechnically speaking, the font of the Access
box can be changed, but I believe it involves changing the system settings
of the OS itself. I don't think you want to go there.
 
G

Glint

Thanks for your suggestion, Fredg.
But how do you suggest I make the unbound form fit the message? If I have
just one a few words in a large form, it would not make sense.
Please help again.
 
F

fredg

Thanks for your suggestion, Fredg.
But how do you suggest I make the unbound form fit the message? If I have
just one a few words in a large form, it would not make sense.
Please help again.

Does it really matter? If it does matter to you, no reason why you
can't simply have 2 different forms, one small the other large.
Simplest way to go.
or...
Look up the MoveSize method in VBA help.
You can position the form and also size it however you wish.
Just remember that all measurements are in Twips 1440 per Inch), so
DoCmd.MoveSize , , 2880, 1440
will size the form 2" x 1".
You can concatenate size instructions onto the OpenArgs argument when
you open the message form:

DoCmd.OpenForm "MessageForm" , , , , , acDialog,"Your
Message|2880,1440"

Then parse the OpenArgs into the message and size wanted by searching
for the "|" separator in the Message form's Load event.

Private Sub Form_Load()

If Not IsNull(Me.OpenArgs) Then
Dim strMessage As String
Dim strSize As String
Dim intX As Integer
Dim intY As Integer

strMessage = Left(OpenArgs, (InStr(OpenArgs, "|") - 1))

strSize = Mid(OpenArgs, InStr(OpenArgs, "|") + 1)
intX = Val(Left(strSize, InStr(strSize, ",") - 1))
intY = Val(Mid(strSize, InStr(strSize, ",") + 1))
DoCmd.MoveSize , , intX, intY

' Include code here to also re-size the label to 1/2 the width and
' height of the form. Note: you can also resize according to the
' number of characters in the strMessage. The choice is yours.
' Reposition the controls also, if needed. Experiment.

Me.LabelName.Height = intY/2
Me.LabelName.Width = intX/2
LabelName.Caption = strMessage

End If
End Sub

You'll have find the method that works for you.
 
G

Glint

Thanks again, Fredg.
--
Glint


fredg said:
Does it really matter? If it does matter to you, no reason why you
can't simply have 2 different forms, one small the other large.
Simplest way to go.
or...
Look up the MoveSize method in VBA help.
You can position the form and also size it however you wish.
Just remember that all measurements are in Twips 1440 per Inch), so
DoCmd.MoveSize , , 2880, 1440
will size the form 2" x 1".
You can concatenate size instructions onto the OpenArgs argument when
you open the message form:

DoCmd.OpenForm "MessageForm" , , , , , acDialog,"Your
Message|2880,1440"

Then parse the OpenArgs into the message and size wanted by searching
for the "|" separator in the Message form's Load event.

Private Sub Form_Load()

If Not IsNull(Me.OpenArgs) Then
Dim strMessage As String
Dim strSize As String
Dim intX As Integer
Dim intY As Integer

strMessage = Left(OpenArgs, (InStr(OpenArgs, "|") - 1))

strSize = Mid(OpenArgs, InStr(OpenArgs, "|") + 1)
intX = Val(Left(strSize, InStr(strSize, ",") - 1))
intY = Val(Mid(strSize, InStr(strSize, ",") + 1))
DoCmd.MoveSize , , intX, intY

' Include code here to also re-size the label to 1/2 the width and
' height of the form. Note: you can also resize according to the
' number of characters in the strMessage. The choice is yours.
' Reposition the controls also, if needed. Experiment.

Me.LabelName.Height = intY/2
Me.LabelName.Width = intX/2
LabelName.Caption = strMessage

End If
End Sub

You'll have find the method that works for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top