Results 1 to 5 of 5
  1. #1
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142

    Message In Message Box

    I have a message box which shows the message below:


    Msg = Msg & "Do you want to add it? **IF YES ADD ACATEGORY**"

    Is there a way to make it look like this?:
    Msg = Msg & "Do you want to add it? **IF YES ADD A CATEGORY**"
    i.e. two lines the second line being bold

    The complete current code is below for "Not In List":
    Dim i As Integer
    Dim Msg As String
    If NewData = "" Then Exit Sub
    Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr
    Msg = Msg & "Do you want to add it? **IF YES ADD A CATEGORY**"
    i = MsgBox(Msg, vbQuestion + vbYesNo, "Shopping List...")
    If i = vbYes Then
    strSQL = "Insert Into CatItem_tbl ([Item]) " & _
    "values ('" & NewData & "');"
    CurrentDb.Execute strSQL, dbFailOnError
    Response = acDataErrAdded
    Else
    Response = acDataErrContinue
    End If
    Hope someone can help.............




  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    You cant control font in a msg box. Its just a way to respond.
    You'd have to show a dialog FORM with a label. Then you can do fonts.

  3. #3
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Not by using the default message box. Use a pop up form. One more option found on web uses rich text box. Here is the link http://blog.nkadesign.com/2008/ms-ac...x-replacement/

  4. #4
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    This isn't quite what you are looking for - it puts the first line in bold - but you might find it useful. I got it may years ago off one of these boards, and it emulates a functionality Access to have prior to A2010.

    Code:
    Function FormattedMsgBox( _
      prompt As String, _
      Optional buttons As Variant = vbOKOnly, _
      Optional title As String = "My Title", _
      Optional HelpFile As Variant, _
      Optional context As Variant) As Integer
        
      Dim strMsg As String, quote As String
      Dim sTemp As String
      
      On Error GoTo Error_Proc
      
      sTemp = strtran(prompt, """", """""")
      quote = Chr(34)
        
      If IsMissing(HelpFile) Or IsMissing(context) Then
       strMsg = "msgbox(" & _
       quote & sTemp & quote & _
       ", " & buttons & _
       ", " & quote & title & quote & _
       ")"
      Else
       strMsg = "msgbox(" & _
       quote & sTemp & quote & _
       ", " & buttons & _
       ", " & quote & title & quote & _
       ", " & quote & HelpFile & quote & _
       ", " & context & _
       ")"
      End If
      FormattedMsgBox = Eval(strMsg)
      Exit Function
    Error_Proc:
      ' Code for error here
    End Function
    The resulting message has three lines, the first one being bold. You call it like this:

    x = Formattedmsgbox("Line 1 bold@Line 2 normal@line 3 normal",VBYesNo,"Window title")

    You can also put a help reference in, if you feel ambitious.

    John

  5. #5
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142
    Thanks to everyone appreciate your help

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 01-23-2014, 12:40 PM
  2. Replies: 15
    Last Post: 11-01-2013, 03:24 PM
  3. Replies: 9
    Last Post: 09-26-2012, 12:20 PM
  4. Message Box
    By crowegreg in forum Programming
    Replies: 2
    Last Post: 05-23-2012, 10:00 AM
  5. Message Box
    By JayX in forum Access
    Replies: 6
    Last Post: 12-13-2011, 02:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums