VBA not working on Access Runtime 2010

Pauleta86

New member
Local time
Today, 17:58
Joined
Apr 1, 2014
Messages
8
Hi All,

First of all thanks for looking into my issue. This is a serious one and I have looked across the internet for a long time without finding the solution...

I have created an order tracing number for one of my clients who does not own MS Access 2010. So I had him install the Runtime version of it. Now I have this particular piece of code (see below) which I run in order to automatically send an e-mail with an order confirmation, where the report is copied so that the name of the pdf file is equal to the ordernumber. Works like a charm in Access 2010, however in the runtime version it doesn't do anything! Even no errors :-(

Private Sub Command28_Click()

On Error GoTo errHandler
Dim vRecipient As String
Dim vMsg As String
Dim vSubject As String

vMsg = "Please find attached your Order Confirmation"
vSubject = Forms![Order_header_form]![Ordernummer] & " - Orderbevestiging"
vRecipient = Forms![Order_header_form]!
[List182]
vReportname = Forms![Order_header_form]![Ordernummer]

On Error Resume Next
DoCmd.CopyObject , vReportname, acReport, "Confirmation"
DoCmd.SendObject acReport, vReportname, "PDFFormat(*.pdf)", vRecipient, , , vSubject, vMsg, True
DoCmd.DeleteObject acReport, vReportname

exitOnErr:
Exit Sub
errHandler:
If Err.Number <> 2501 Then MsgBox "Error (" & Err.Number & ") - " & Err.Description, vbCritical
Resume exitOnErr

End Sub
I already simulated a runtime on my own computer and there it does work perfectly.

Any idea guys? I am really desperate. Thanks again!!

ps. Lately I discovered I discovered that some other macro is not working also. This one is a split-screen form which has a exit-button which should save the screen layout (resizing coilumsn, etc), however it doesn't... Might be the same cause?
 
Is the db in a trusted location or has the user explicitly enabled code?
 
Is the db in a trusted location or has the user explicitly enabled code?

accde file is located on desktop (how can I check if this is a 'thrusted location' or is it always?) and afaik the user did not explicitly enable code, security settings are set to not block macro's.
 
This is 2007, but 2010 is similar.

...

In the runtime I don't know that you can get at the options. I add a registry setting to make the location trusted.

Added the path to registry as a thrusted locations, still nothing happens...
 
On the user's PC or yours? Has to be theirs. Just to make sure this is the problem, have them click on the enable code or whatever the button says right under the ribbon.
 
some proper error handling would help show you the problem, I am sure. you are just ignoring every error
 
On the user's PC or yours? Has to be theirs. Just to make sure this is the problem, have them click on the enable code or whatever the button says right under the ribbon.

Yes, on theirs of course ;-)
 
some proper error handling would help show you the problem, I am sure. you are just ignoring every error

How can I introduce proper error handling? That piece of code I just copied from an example...

Really desperate, thanks a lot for your support guys.
 
You have proper error handling except for this line:

On Error Resume Next

which will basically ignore errors from that point on. Did you have the user enable code so we're sure that's the problem?
 
You have proper error handling except for this line:

On Error Resume Next

which will basically ignore errors from that point on. Did you have the user enable code so we're sure that's the problem?

Yes code is enabled. Some other simple macro's (like next record, previous record, close form, generating print preview of report) are working fine, however this one and the save layout one are just not working... Very strange :banghead:
 
re error handling

at this point

Code:
 On Error Resume Next
DoCmd.CopyObject , vReportname, acReport, "Confirmation"
DoCmd.SendObject acReport, vReportname, "PDFFormat(*.pdf)", vRecipient, , , vSubject, vMsg, True
DoCmd.DeleteObject acReport, vReportname
if any of these statements fail, since you have instructed your programme to ignore the failure - your process will just continue until it finishes, ignoring (failing) at each step. So nothing happens, which is what you described.

I would take out the "on error resume next", and also the "2501" error - (which in some cases you would want to know). you will at least then know what is going wrong.
 
re error handling

at this point

Code:
 On Error Resume Next
DoCmd.CopyObject , vReportname, acReport, "Confirmation"
DoCmd.SendObject acReport, vReportname, "PDFFormat(*.pdf)", vRecipient, , , vSubject, vMsg, True
DoCmd.DeleteObject acReport, vReportname
if any of these statements fail, since you have instructed your programme to ignore the failure - your process will just continue until it finishes, ignoring (failing) at each step. So nothing happens, which is what you described.

I would take out the "on error resume next", and also the "2501" error - (which in some cases you would want to know). you will at least then know what is going wrong.

Already tried that, no errors pop up. Strange thing is that it works like a charm on my full access version, however in runtime it doesn't. We might want to focus on Save layout macro, which is very simple, which is also not working at all without error...

Macro is "CloseWindow" with Save = "Yes".
 
silly question, but the users DO have a mail client (outlook), do they?
 

Users who are viewing this thread

Back
Top Bottom