Results 1 to 5 of 5
  1. #1
    Nico90210 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    3

    Angry Embedded images in report-records while using SQL in recordsource

    Hi, I've got a strange issue where i've been searching for some time without finding a good answer:



    I have a database with embedded illustrations which I use to make sparepart lists. The records are all retrieved and nicely ordered inside a report.
    In the past worked a lot with queries and this went just fine. Now recently I started to work with VBA to automate and speed up some things.
    Now I make reports via SQL with the correct records (just like i had with the integrated queries before in the recordsource), however I noticed, the images are not visible in the reports

    I narrowed down and figured out the following:

    When I link the recordsource of an (illustrated) report to a query inside the report's properties, the images in my report (which are embedded images per record) are visible.
    When however, I use an SQL statement inside the recordsource, which is exactly corresponding to the queries I used before, the images are NOT visible in my report

    Does somebody knows what I should do to obtain my images in my reports especially when I want to work with SQL instead of queries (inside my report?)
    I really would like to work with SQL as can easily create the correct statements/code in vba...

    Thank you!

  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,929
    Are you using VBA to set the RecordSource property of a report? Why?
    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
    Nico90210 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    3
    Quote Originally Posted by June7 View Post
    Are you using VBA to set the RecordSource property of a report? Why?
    I have around 200 reports to make (200 sparepart lists) with different data and images. I have made a script that can fully automate this saving me almost a week of time :-)
    So instead I made 1 generic report and via VBA loop and modifying the recordsouce via an SQL I can retrieve the correct data.

    sqlGenerateSparepartlist = "SELECT * FROM QUERY_UNIFIED_SPAREPARTLISTS WHERE (((QUERY_UNIFIED_SPAREPARTLISTS.[Units List])=55 Or (QUERY_UNIFIED_SPAREPARTLISTS.[Units List])=56) AND ((QUERY_UNIFIED_SPAREPARTLISTS.Mutoh)=Yes));"

    DoCmd.OpenReport "SPL_machinetype_EUR_xxxxxxxx_blauw_ILLUSTRATE D", acViewReport 'Output generic report
    'Reports![SPL_machinetype_EUR_xxxxxxxx_blauw_ILLUSTRATED].RecordSource = sqlGenerateSparepartlist 'Execute SQL query for putting correct information into report
    'DoCmd.OpenReport "SPL_machinetype_EUR_xxxxxxxx_blauw_ILLUSTRATE D", acViewPreview 'Output generic report
    'DoCmd.OutputTo acOutputReport, "", acFormatPDF, MyPath & MyFilename, False
    'DoCmd.Close acReport, "SPL_machinetype_EUR_xxxxxxxx_blauw_ILLUSTRATE D"

    With the test I did below I have narrowed down the issue that something is happening wrong inside the report:
    Now, I tried to put an embedded query inside my report 'manually' in the RecordSource property, and in this case all the pictures are visible on my report.
    When I however tried to paste the SQL statement inside the RecordSource property, the pictures won't show up inside the report.

    Somehow, it seems to mee, the picture field doesn't get bound to the database anymore when I use an SQL statement instead...?

  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,929
    What exactly is changed in the query? If it is only the WHERE clause, try using the WHERE CONDITION argument of the DoCmd.OpenReport to pass filter criteria to the report. The base RecordSource remains unchanged.
    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
    Nico90210 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    3
    Quote Originally Posted by June7 View Post
    What exactly is changed in the query? If it is only the WHERE clause, try using the WHERE CONDITION argument of the DoCmd.OpenReport to pass filter criteria to the report. The base RecordSource remains unchanged.
    Hi

    The variable data is built of the following string where the numbers (as well numbers, but also amount of unit list) and the last part yes/no varies.
    ((QUERY_UNIFIED_SPAREPARTLISTS.[Units List])=55 Or (QUERY_UNIFIED_SPAREPARTLISTS.[Units List])=56) AND ((QUERY_UNIFIED_SPAREPARTLISTS.Mutoh)=Yes))

    I managed to use the filter functionality you proposed above in the docmd.openreport command and dropped the SQL execution/recordsource chang. Therefore it keeps the recordsource defined in the report (including the pictures properly).

    This solved my problem, thanks for the reply and the hint !

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

Similar Threads

  1. Replies: 1
    Last Post: 02-09-2012, 11:33 PM
  2. Replies: 1
    Last Post: 08-13-2011, 04:17 PM
  3. How to Import Outlook emails with embedded images
    By imav in forum Import/Export Data
    Replies: 1
    Last Post: 08-06-2011, 09:53 AM
  4. Replies: 17
    Last Post: 08-26-2009, 11:27 AM
  5. Access Report and embedded images
    By joypanattil in forum Reports
    Replies: 0
    Last Post: 11-22-2008, 03:50 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