Results 1 to 6 of 6
  1. #1
    drmsktchr is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    9

    Question Passing the ComboBox text value in Access to a Bookmarked Location in Word

    So, I am an extreme newbie when it comes to using VB in Access. But, I have created a Form to help automate a Report in Word. I have been successful in getting all the the text boxes to populate the appropriate bookmarks within the Word Report. The issue I am having currently, I have a combo box holding names (first and last) that is being populated by a query from a table. When I submit the form, it populates the associated bookmark in Word as an Integer value, but what I need is it to be passed as the actual string. I have searched threads for a couple of days on some assistance and to no avail. So I am here hoping for help. Can anyone help direct me or guide me.



    The code I am using is the following:

    'Move to each bookmark and insert the text from the form to Word document
    .ActiveDocument.Bookmarks("preparedBy").Select
    .Selection.Text = (CStr(Forms!WebBasedIFV!comboPreparedBy))
    'reapply the bookmark name to the selection throughout rest of Word Document
    .ActiveDocument.Bookmarks.Add Name:="preparedBy", Range:=Selection.Range

    So what will I need to do in order to have the form output the actual String of the name?

  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
    .Selection.Text = (CStr(Forms!WebBasedIFV!comboPreparedBy.Column(x)) )

    Where x is the number of the desired column of the combo's row source (zero based).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    drmsktchr is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    9

    Thumbs up

    Quote Originally Posted by pbaldy View Post
    .Selection.Text = (CStr(Forms!WebBasedIFV!comboPreparedBy.Column(x)) )

    Where x is the number of the desired column of the combo's row source (zero based).
    Hi Paul, thank you so much for your help, that seems to have solved the problem. Now my next task is to figure out how to return values from a list box if there are multiple selections.

    Thank you again Paul.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem. This isn't doing exactly what you want, but the loop is the typical way to get selected items from a multiselect listbox.

    http://www.baldyweb.com/multiselect.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    drmsktchr is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    9
    Thank you Paul, you have been a tremendous help.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem, and welcome to the site by the way!
    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. Dyanmic location for transfer text
    By shanmugamgsn in forum Access
    Replies: 5
    Last Post: 07-17-2012, 11:30 PM
  2. Replies: 2
    Last Post: 10-01-2010, 04:28 AM
  3. Passing variables to a Word Doc.
    By techexpressinc in forum Forms
    Replies: 2
    Last Post: 09-16-2010, 01:04 PM
  4. Replies: 1
    Last Post: 03-24-2010, 08:42 AM
  5. Passing specific Combobox info to a query
    By pwdpwd in forum Queries
    Replies: 1
    Last Post: 02-09-2010, 12:53 PM

Tags for this Thread

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