Results 1 to 6 of 6
  1. #1
    Rzadziu is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2012
    Posts
    28

    Can't run code :-(

    Hello All,

    Probably it's too simple to ask in here but i'm creating/modifying my old database and have a problem to run some code.
    I want to send a report as PDF by email and for that i have create button with this code

    Code:
    Private Sub Polecenie11_Click()    
            
            DoCmd.SendObject acSendReport, "Report", acFormatPDF, "recipient@compaty.com", [cc email(s)], [bcc email(s)], [message subject], [messagebody], True
                  
    End Sub
    Unfortunately im getting error message.

    Click image for larger version. 

Name:	1.JPG 
Views:	27 
Size:	61.1 KB 
ID:	25938
    Im using Access 2016 what should i do to run this??

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    This is an ActiveX error, not syntax.
    Your code may not be the problem. It may be somewhere else in the app.

    Try changing the TRUE to false.
    Do you have an object on the form?
    Did you check the references via VBE menu : tools, references. Are there any Missing?
    does the app compile?

  3. #3
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I agree. I have got this error when my OnClick has got corrupted. I go into design mode, remove it, add it back, hit the three dots and make sure it points to the right procedure.

  4. #4
    Rzadziu is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Mar 2012
    Posts
    28
    Hello ranman256
    This particular database i have shown is new there is no object on the form.
    This is screen shot from References
    Click image for larger version. 

Name:	Capture.JPG 
Views:	24 
Size:	53.0 KB 
ID:	25943

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    It could be your command is calling the Outlook ActiveX.
    change the TRUE to False.

  6. #6
    Rzadziu is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Mar 2012
    Posts
    28
    Quote Originally Posted by ranman256 View Post
    It could be your command is calling the Outlook ActiveX.
    change the TRUE to False.
    I have tried that and its the same.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-22-2016, 02:37 AM
  2. Replies: 20
    Last Post: 10-13-2015, 09:05 AM
  3. Replies: 3
    Last Post: 10-16-2014, 08:49 AM
  4. Replies: 7
    Last Post: 05-28-2013, 09:11 AM
  5. Replies: 1
    Last Post: 05-04-2013, 12:19 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