Results 1 to 3 of 3
  1. #1
    mar7632 is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Feb 2019
    Location
    Spain - Madrid
    Posts
    72

    error on print current record

    Hi everyone,

    I have a problem with the next code:

    Code:
    Private Sub btnImprimir_Click()
    DoCmd.OpenReport "Informe_Correo", acNormal, "", "[aa_DatosRecibidos]![id_item]=" & Me.id_item
    End Sub
    Informe_correo = report
    aa_DatosRecibidos = table



    My goal is to print the current record I am in a form. When the button is clicked a window comes up:
    Click image for larger version. 

Name:	captura imprimir.PNG 
Views:	13 
Size:	43.6 KB 
ID:	38360

    What I expect is that the Print setting appears but it doesnot. When I close this window an error takes places highlighting the code I wrote before. And when I create a PDF (by saving it)the printing does not take place.

    There are another codes which are functional but it takes 2 steps to print. (you click the button on a certain record and then the report is opened and you are are able to print it.) My idea is to carry out this things using the form.

    What is it happening? Any idea?

    Thank you in advance

  2. #2
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    You have to filter the report using a report field, not another tables field value.
    Assuming ID_Item is in the report then your code should simply be

    Code:
    DoCmd.OpenReport "Informe_Correo", acNormal, , "[id_item]=" & Me.id_item
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,928
    Don't see anything wrong with code. Looks like PDF print driver is default printer. Or report Page Setup has been set to use PDF printer.
    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. How to print current record
    By hursan1710 in forum Access
    Replies: 1
    Last Post: 11-10-2016, 10:06 AM
  2. Print Report from Current Record
    By hnkford in forum Reports
    Replies: 15
    Last Post: 05-22-2015, 08:08 AM
  3. How can I print an object for the current record?
    By alexandervj in forum Access
    Replies: 3
    Last Post: 12-06-2013, 04:03 PM
  4. Print current record to a report
    By drawc in forum Access
    Replies: 2
    Last Post: 01-15-2012, 12:48 AM
  5. Replies: 5
    Last Post: 10-26-2011, 02:59 PM

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