Results 1 to 6 of 6
  1. #1
    stas is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    3

    Question Access Macro to change Attachment

    Hallo,

    for now i have an Form with a combobox, where i can select an worker and then click Macro (Button) to open an Report. This report is a Dokument (.png from former pdf form) where i fill in names, adresses etc based on combobox selection. The Problem is that with the Button i want also be able to change the .png picture based on column 4 in combobox called "status".


    My IF statement idea is for now
    [Forms]![fFillDoku]![cboWorker].[Column](3)="retired"
    with Open Report and WHERE condition
    [Reports]![rDoku]![Attachment].[DefaultPicture]="First1.png"

    but this does not work. Is there any way to make it work with Where condition on open Report?

    thx
    Stas

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Don't understand. Are you opening an Access report? This report has a png image displayed in an Image control on report? You are storing png image in an Attachment field in table?

    If you have image stored in Attachment field then have to include that table in the report RecordSource.

    I do not see any If or IIf code in your post.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    stas is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    3
    Unfortunately i am not able to upload the file, eaven w 2MB DB. I have a report that has an Attachment (Acting like an background image). I want to be able to change the image based on combo box selection with a macro that opens the form

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    So you are trying to use image in table Attachment field as the background of report?

    AFAIK, image has to be an external file. Example:

    Private Sub Report_Load()
    Me.Picture = "C:\Users\June\Photos\Photo2.png"
    End Sub

    Why a background image? Why not an Image control bound to Attachment field? Set ControlSource property.
    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.

  5. #5
    stas is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    3
    Hay,

    thank you for the Reply. I send you the DB via OneDrive link couse else it's to big. https://1drv.ms/u/s!Autg-RpGoJvDjT28Y3R4taPePVJs
    I use the background img. becouse on top of this attachment i want query results to appear.
    This:
    Private Sub Report_Load()
    Me.Picture = "C:\Users\June\Photos\Photo2.png"
    End Sub
    is for VBA right? An absolute path is rly not suited but will try if it works

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Sorry, can't open rar files.

    The path can be dynamic if it is stored in a text field.

    Me.Picture = [ImagePath]
    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. Replies: 2
    Last Post: 11-13-2016, 08:15 AM
  2. Change Image via Macro Designer Access 2010
    By joseinazusa in forum Macros
    Replies: 4
    Last Post: 01-15-2014, 06:14 PM
  3. Attachment file location change
    By gary742 in forum Access
    Replies: 3
    Last Post: 03-22-2011, 12:26 PM
  4. Replies: 0
    Last Post: 01-12-2011, 12:43 PM
  5. Change a Picture in an Attachment
    By ksmith in forum Access
    Replies: 2
    Last Post: 08-18-2010, 11:17 AM

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