Results 1 to 4 of 4
  1. #1
    Berger1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    2

    Inserting an image (OLE object) into a form based on combo box result

    Hi,

    I have a form that is based on a query of 2 tables: 'Job Number Table' and 'Client Table'. The form automatically displays all of the relevant info in text box fields based on a combo box (CboJobNumber) that selects the job number. That is, the user selects a job number from the combo box, and the rest of the form updates to include all of the relevant info for that job, like client name and address, site details etc.

    Now the complicated part (at least for me) is that i would like to have another combo box down the bottom of the form that selects information from a different table [Employee Table] that includes an OLE object (a small signature image as .bmp). I just can't figure out how to get the signature onto the form based on the result of the combo box (CboEmployeeName).

    I think i need some VBA code that After Update identifies what the combo box selection is (which is linked to the [Employee Table]), finds that record from the [employee table] and then grabs the corresponding OLE object (the signature) and puts it into a field on the form.

    Now i should say that the whole point of this is that i am trying to get these fields onto a form so that i can use all of these form fields to populate a Word template (into corresponding bookmarks). I have the code already to get the word doc up and running, just without the signature showing up..... So i will also need to figure out how to get the image from the Access Form into the Word Bookmark. ie: will this work

    Private Sub CmdBtnMrg_Click()

    Dim SignatureVar as Object

    SignatureVar = CboEmployeeName

    'Start MS Word
    Dim Wrd As New Word.Application
    Set Wrd = CreateObject("Word.Application")

    'Open up Template
    Wrd.Documents.Add "C:\Filepath\LetterTemplateOnePage.dotx"
    Wrd.Visible = True

    'Replace Bookmarks with data
    With Wrd.ActiveDocument.Bookmarks
    .Item("SignatureBookmark").Range.Text = SignatureVar

    End Sub

    Please Help

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    These images are saved in the table? I doubt can pass the image into Word. Have you tested? Let us know errors you encounter and maybe someone can advise.

    Why do you have to use Word? Could an Access report produce the same desired output?
    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.

  3. #3
    Berger1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    2
    Hi, Yes the images are saved in the table at present, they are just little signatures and there are only 6 so i figured it was ok to embed them in the database. It needs to be outputted as a word document as we need to add extra info after the fields are populated. We're pretty much auto-generating letters and reports based on the info in the database (client name, site name, employee, site address etc. etc.).

    Would it be easier to get the signatures onto the word doc if they were not embedded in the database, ie. if they were in the table as links and stored on the hard drive rather than in the db as OLE objects?

    Is it even possible to insert images into Word documents from access using VBA or am i barking up the wrong tree?

    thanks for your time!

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    I have never set up interface code between Word and Access. I have made attempts to handle images stored in table (such as update another table image field with the image). The actual images could not be 'moved/copied/transferred'. What you can do is pass the folder/file path of an object outside the database as a string value. So if the path string is stored in a text field, pass that string to Word.

    What 'other info' is added after fields are populated? Even this could probably be handled by Access.
    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.

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

Similar Threads

  1. Link vs. imbed image: result is counterintuitive
    By VirgilMachine in forum Access
    Replies: 14
    Last Post: 12-13-2011, 01:55 PM
  2. inserting query result in a form
    By nichmeg in forum Forms
    Replies: 1
    Last Post: 10-17-2011, 06:42 AM
  3. Replies: 3
    Last Post: 06-04-2011, 12:23 PM
  4. Replies: 6
    Last Post: 12-27-2010, 10:26 PM
  5. Image change based on combo box
    By bosve73 in forum Forms
    Replies: 4
    Last Post: 08-09-2010, 02:23 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