UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Docmd Not Working, Access 2010    
 
   
rzw0wr
post Nov 10 2019, 03:29 PM
Post#1



Posts: 319
Joined: 28-March 12
From: Indiana


I am writing a simple program for my niece.
She would like to be able to email an invoice for Access.

I set her up with Runtime 10.
I have even tried the full Access program on her computer.

I got this working OK on my computer with Runtime.

When I download it to her laptop everything work but the Emaill part.


here is the code.
The Docmd,OutputTo will not work on this computer.

PDFPath = "C:\Documents\DeezInvoices\"
PDFFileName = "Invoice.pdf " & Me.FirstName & " " & Me.LastName & "_" & Day(Now) & "_" & Month(Now)
DoCmd.OutputTo acOutputReport, "rptInvoiceEmail", acFormatPDF, PDFPath & PDFFileName,False
DoCmd.OpenForm "frmAAAAMain", acNormal, "", ""

This works great on my desktop but gives me an error and debug says it is this line on her laptop.

I do not see a problem.

Thank you,
Dale

--------------------
Access 2010 32 bit.
Not really very good at access.
Go to the top of the page
 
DanielPineault
post Nov 10 2019, 04:35 PM
Post#2


UtterAccess VIP
Posts: 7,000
Joined: 30-June 11



Your PDFFileName seems very odd to me as you are putting information after the extension. You should also be validating the controls prior to trying to assign them to populating a string value.
The Folder exists?
What's the exact error you receive?

Why are you passing empty strings to your OpenForm method? Simply do
CODE
DoCmd.OpenForm "frmAAAAMain", acNormal

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
GroverParkGeorge
post Nov 10 2019, 04:36 PM
Post#3


UA Admin
Posts: 36,175
Joined: 20-June 02
From: Newcastle, WA


Usually, it's easier to offer specific suggestions when we see the specific error message, i.e. the error number and the error description.

Thanks.


--------------------
My Real Name Is George. Grover Park Consulting is where I did business for 20 years.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
rzw0wr
post Nov 10 2019, 05:34 PM
Post#4



Posts: 319
Joined: 28-March 12
From: Indiana


error code 2501.

I can't understand how it can work on one computer and not another.

--------------------
Access 2010 32 bit.
Not really very good at access.
Go to the top of the page
 
GroverParkGeorge
post Nov 10 2019, 06:39 PM
Post#5


UA Admin
Posts: 36,175
Joined: 20-June 02
From: Newcastle, WA


Error code 2501 means that the action was cancelled.

That means when Access tries to output the pdf file, there is a problem and the output has to be cancelled.

So, what could be wrong?

As Daniel points out, the naming convention seems unusual. That may be the problem. Your result is going to be something like:

Invoice.pdfJason Bourne_10_11

That's not a valid file name is it? Does this same syntax actually produce a file on the original computer with names like that?


Also, you specify and folder called "C:\Documents\DeezInvoices\"

That may or may not exist on the second computer. Did you create it? Did you designate it as a Trusted Location so Access can actually write to it? Do you have proper Window permission to write to it?


--------------------
My Real Name Is George. Grover Park Consulting is where I did business for 20 years.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
rzw0wr
post Nov 10 2019, 09:20 PM
Post#6



Posts: 319
Joined: 28-March 12
From: Indiana


I have tried using a file name and path to a know directory in the outputT0 command and nothing works.

I had the same problem on the desk top computer but it cleared itself up. Some how?????

Sendto does not work either.

--------------------
Access 2010 32 bit.
Not really very good at access.
Go to the top of the page
 
DanielPineault
post Nov 10 2019, 09:26 PM
Post#7


UtterAccess VIP
Posts: 7,000
Joined: 30-June 11



Just for fun try
CODE
    PDFPath = Environ("UserProfile") & "\Desktop\"
    PDFFileName = "Invoice.pdf"
    DoCmd.OutputTo acOutputReport, "rptInvoiceEmail", acFormatPDF, PDFPath & PDFFileName
    DoCmd.OpenForm "frmAAAAMain", acNormal


Also, if you try to open your report "rptInvoiceEmail" does it work properly without any user interventions, prompts, ...?

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
rzw0wr
post Nov 10 2019, 11:45 PM
Post#8



Posts: 319
Joined: 28-March 12
From: Indiana


Funny thing.

The laptop I am using will not let Access create a file or directory to it.

I looked at the permissions and they looked OK.

I hooked up an external disk, formatted it and all is good.

Strange stuff here. iconfused.gif pullhair.gif

Thank for all the help and replies.

Dale

--------------------
Access 2010 32 bit.
Not really very good at access.
Go to the top of the page
 
rzw0wr
post Nov 13 2019, 11:56 PM
Post#9



Posts: 319
Joined: 28-March 12
From: Indiana


More FYI on this post.

It appears that Access will not save an outputTo any computer C drive.
My very well be why SendTo does not work either.

I tried on 3 different computers.


Dale

--------------------
Access 2010 32 bit.
Not really very good at access.
Go to the top of the page
 
DanielPineault
post Nov 14 2019, 05:11 AM
Post#10


UtterAccess VIP
Posts: 7,000
Joined: 30-June 11



Did you try my modified code?

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    9th December 2019 - 04:49 AM