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
> Errors In Autoexec Macro, Access 2016    
 
   
t84a
post May 31 2019, 07:43 AM
Post#1



Posts: 47
Joined: 5-September 09



I can't seem to resolve 2 errors in my AutoExec macro. I believe they are tied to Trusted Locations and/or Trusted File, however, both the location and file are set up in Trust Center. Any thoughts?
Attached File(s)
Attached File  AutoExecErrors.jpg ( 39.42K )Number of downloads: 6
 

--------------------
Ken from Maryland USA
Go to the top of the page
 
DanielPineault
post May 31 2019, 08:03 AM
Post#2


UtterAccess VIP
Posts: 6,858
Joined: 30-June 11



Those aren't Errors, but rather Warnings. Access shows that icon for a select set of commands just so you are aware they serious in nature and you should take great care in using them. So basically, just ignore them, they mean nothing in the grand scheme of things.

Also, be careful. I would never SetWarning off globally at the start of a database. If I need them off for a particular action, then I'll disable them for that one action, but I would never disable them throughout an application. The warnings are there for a reason and can be disabled when specifically needed. By simply disabling throughout, a user could inadvertantly do something and never be prompted for confirmation and end up making a total mess of things (and yes, I seen this exact scenario before and had to clean up the mess left behind by the previous developer).

--------------------
Daniel Pineault (2010-2019 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://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
 
t84a
post May 31 2019, 08:10 AM
Post#3



Posts: 47
Joined: 5-September 09



Thanks. The problem is that they aren't working. I still get pop ups.
Attached File(s)
Attached File  OverwriteError.jpg ( 99.98K )Number of downloads: 13
 

--------------------
Ken from Maryland USA
Go to the top of the page
 
DanielPineault
post May 31 2019, 08:16 AM
Post#4


UtterAccess VIP
Posts: 6,858
Joined: 30-June 11



What isn't working. You were talking about AutoExec macro, but now you are showing Saved Export. You're going to have to give us more detail.

What is wrong with the Saved Export, it is simply prompting to overwrite the existing file or not, that is quite normal.

--------------------
Daniel Pineault (2010-2019 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://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 May 31 2019, 08:37 AM
Post#5


UA Admin
Posts: 35,695
Joined: 20-June 02
From: Newcastle, WA


Attached File  MacroWarnings.jpg ( 82.91K )Number of downloads: 0


Looking at the Macro Design interface, you can see what Daniel is telling you.

Microsoft considers certain types of macro actions to be potentially unsafe. As Daniel points out, turning Warnings Off allows the potential for bad things to happen without any indication that it happened, or it can mean some things don't work as you expect, but don't give you any warning of that.

Your current problem is pretty straightforward, based on that screenshot. The macro is working, although maybe not the way you would like it to work.

The macro is trying to create or update an existing Excel Workbook. Is that not what you want to have happen? Or do you want to have it happen without confirmation?

Maybe you should check for the existence of the OpenOrderWeb.xls file first, and then decide whether to overwrite or create it.

But that screenshot isn't even a macro. It's a saved export. So that means you are invoking that saved export somewhere. I assume in another macro, or (preferably) in VBA where you can manage the export process better than in a macro.

In any event, setting Warnings on or off won't change this, I don't think.

Show us the code (VBA or macro) which invokes this saved export.

Thank you.

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
t84a
post May 31 2019, 08:38 AM
Post#6



Posts: 47
Joined: 5-September 09



I shouldn't be getting the pop up. It worked fine until I replaced my laptop and upgraded to 2016.

--------------------
Ken from Maryland USA
Go to the top of the page
 
GroverParkGeorge
post May 31 2019, 08:44 AM
Post#7


UA Admin
Posts: 35,695
Joined: 20-June 02
From: Newcastle, WA


Subtle problems like this have been an unfortunate experience shared by others upgrading Office to newer versions.

If you can show us the macro (or, preferably, you did it with VBA) which creates this export, perhaps we can offer suggestions.

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
DanielPineault
post May 31 2019, 08:57 AM
Post#8


UtterAccess VIP
Posts: 6,858
Joined: 30-June 11



QUOTE
I shouldn't be getting the pop up. It worked fine until I replaced my laptop and upgraded to 2016.

In that case, we'd need to see the code used to create the export.

--------------------
Daniel Pineault (2010-2019 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://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
 
gemmathehusky
post May 31 2019, 09:49 AM
Post#9


UtterAccess VIP
Posts: 4,725
Joined: 5-June 07
From: UK


for action queries

docmd.openquery and currentdb.execute are subtly different


if you turn off warnings,
docmd.openquery will complete and not advise of any errors, which may or may not be sensible
it you leave them on, you have to reply to numerous prompts


currentdb.execute, however, will let you trap errors, but will not prompt for every step of the process.

--------------------
Dave (Male)

(Gemma was my dog)
Go to the top of the page
 
t84a
post May 31 2019, 11:04 AM
Post#10



Posts: 47
Joined: 5-September 09



I don't want it to ask me if I want to overwrite the existing file. I have 4 of these queries that create Excel and Word files. For some reason on the Excel side, it asks me 2x if I want to overwrite the same existing file. I had this turned off previously. Are you saying that the Set Warnings and Set Echo to No is not the way to accomplish this? Thanks for the replies.

--------------------
Ken from Maryland USA
Go to the top of the page
 
t84a
post May 31 2019, 11:18 AM
Post#11



Posts: 47
Joined: 5-September 09



From MS Access Help.
Attached File(s)
Attached File  SetWarnings.png ( 24.19K )Number of downloads: 0
 

--------------------
Ken from Maryland USA
Go to the top of the page
 
GroverParkGeorge
post May 31 2019, 11:18 AM
Post#12


UA Admin
Posts: 35,695
Joined: 20-June 02
From: Newcastle, WA


As mentioned a couple of times, we'd have to see your code to be able to offer specific suggestions.

Unfortunately, later versions of Access often have subtle differences that can only be resolved by looking at the specific features/functions involved.

Thanks.

BTW: are you sure this is NOT coming from Excel, as opposed to Access? " For some reason on the Excel side, it asks me 2x if I want to overwrite the same existing file."

Is there a setting in your 2016 instance of EXCEL that could be involved?

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
t84a
post May 31 2019, 11:42 AM
Post#13



Posts: 47
Joined: 5-September 09



Definitely Access errors. It says Microsoft Access on the pop up. I have read elsewhere that the Trust location had to be set up before you create the file so that may be it. Fortunately, it's just an annoyance. I don't think it can be fixed. Thanks again for all the replies.

--------------------
Ken from Maryland USA
Go to the top of the page
 
DanielPineault
post May 31 2019, 11:46 AM
Post#14


UtterAccess VIP
Posts: 6,858
Joined: 30-June 11



Can you post the code you are using to generate the Excel file(s)? Without it, we can't really help you any further.

You could check for the file's existence (using DIR or a simple function such as http://www.devhut.net/2011/06/05/vba-deter...-exists-or-not/), if found delete it (using the Kill Statement) and then run your code normally. This would be the normal sequence to follow.

--------------------
Daniel Pineault (2010-2019 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://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
 
t84a
post May 31 2019, 12:35 PM
Post#15



Posts: 47
Joined: 5-September 09



The files definitely exist. I run the query every day. I'm not sure how I can get the code since it is part of the Saved Exports. You can't even view or edit what makes up a particular Saved Export. There is a query that doesn't cause a pop up and then the export to Excel or Word that causes a pop up to overwrite the file.

--------------------
Ken from Maryland USA
Go to the top of the page
 
GroverParkGeorge
post May 31 2019, 12:36 PM
Post#16


UA Admin
Posts: 35,695
Joined: 20-June 02
From: Newcastle, WA


Are you saying that you DO NOT use code to run the export?

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
t84a
post May 31 2019, 12:46 PM
Post#17



Posts: 47
Joined: 5-September 09



Correct. Initially years ago, I ran the query and then exported to a file. The pop up asked me if I wanted to save and I said yes. Now I go to Saved Exports and run it.

--------------------
Ken from Maryland USA
Go to the top of the page
 
GroverParkGeorge
post Jun 1 2019, 09:38 AM
Post#18


UA Admin
Posts: 35,695
Joined: 20-June 02
From: Newcastle, WA


Okay, good. Now we understand a bit better how this is designed.

Obviously, then it has nothing to do with the AutoExec macro, regardless of whether you set warnings on or off. And since you are invoking a Saved Export directly, without VBA, telling us that helps us eliminate a whole class of problems we don't have to examine in code with you.

It's a problem in this particular saved export, then.

My first approach to resolving it would be to recreate the entire Saved Export in your CURRENT environment. That way you can go through the process step-by-step and see what is happening, and what has changed in the Office environment (both Access and Excel) that has created this complication.

If that doesn't turn up an Excel issue, then it would seem that the only option might be to share the files involved so someone else can trace the process and try to understand where it is not performing as required.
This post has been edited by GroverParkGeorge: Jun 1 2019, 09:39 AM

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
gemmathehusky
post Jun 15 2019, 04:51 PM
Post#19


UtterAccess VIP
Posts: 4,725
Joined: 5-June 07
From: UK


Perhaps setwarnings false does not deal with external file operations?
Maybe there is another switch to overwrite an existing diskfile without asking.

Also, what would happen if the external file was in use. The write would probably fail, wouldn't it?

--------------------
Dave (Male)

(Gemma was my dog)
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    23rd September 2019 - 04:38 AM