Results 1 to 5 of 5
  1. #1
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117

    Insert Field Value into MsgBox Text

    Hello,

    I've gotten myself in a pickle.

    I have a message box which needs to include the User name when it pops up.
    Subsequently, I have my code as MsgBox "Text here" & Me.Fieldname.Value & "More Text Here".

    Works great...but the field in question is a combo box which is tied to a table including User #, First Name, Last Name.
    Now I have the combo box set up to display just the first/last name by directing
    Row Source to the tbl_userinfo,
    Bound Column = 1
    Column Count = 1


    etc.
    I have no idea how to get my msgbox to display "blah blah John Smith blah blah" instead of "blah blah 123 blah blah"



    Any and all help is appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It would be

    Me.ComboName.Column(x)

    where x was the zero-based column number you wanted. Based on your comment above, the column count property is wrong though.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Reference combobox columns by index. Index begins with zero.

    Like:

    "Text here " & Me.combobox.Column(1) & " " & Me.combobox.Column(2) & " more text here"

    Advise not to use spaces and special characters/punctuation (underscore is exception) in naming convention.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    jtm013 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    117
    Quote Originally Posted by pbaldy View Post
    It would be

    Me.ComboName.Column(x)

    where x was the zero-based column number you wanted. Based on your comment above, the column count property is wrong though.
    Thanks that did it! Yeah, I was typing fast don't worry the column count is actually set up properly.

    Quote Originally Posted by June7 View Post
    Reference combobox columns by index. Index begins with zero.

    Like:

    "Text here " & Me.combobox.Column(1) & " " & Me.combobox.Column(2) & " more text here"

    Advise not to use spaces and special characters/punctuation (underscore is exception) in naming convention.
    Don't worry June 7 no special characters or spaces in the field naming conventions I was just describing the data.

    Thanks to both of you for the quick reply! SOLVED.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to hellp!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 25
    Last Post: 11-23-2014, 02:43 PM
  2. Test String test besed on table data
    By igourine in forum Programming
    Replies: 3
    Last Post: 12-01-2013, 06:16 AM
  3. Replies: 6
    Last Post: 08-16-2012, 04:15 PM
  4. MsgBox to update field. What's next?
    By JeffG3209 in forum Programming
    Replies: 3
    Last Post: 05-05-2011, 12:51 AM
  5. Keying in Test answers to Access DB from Written Test
    By CityOfKalamazoo in forum Access
    Replies: 3
    Last Post: 03-01-2010, 08:58 AM

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