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

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Autoexec V. Manual Code Execution, Access 2016    
 
   
SerranoG
post Oct 14 2019, 01:54 PM
Post#1


UtterAccess VIP
Posts: 2,230
Joined: 1-December 03
From: Lansing, MI USA


I have automated some databases to fire off using Windows scheduled tasks for when I go on vacation, some reports can be generated by my computer running on "auto-pilot." Recently, I've been encountering some odd behavior.

If I open the ACCDB without firing off Autoexec (SHIFT + Double-Click the ACCDB), manually find the module, manually run the module: it creates three PDFs based on three reports and puts the PDFs in the correct shared directory. The database closes. It works great.

If I let the autoexec run (by double-clicking the ACCDB; that is, mimic a scheduled task), the same module is called via a function in a "Run Code" statement, the module creates 1 of 3 reports, fails to create the other reports, fails to put any PDFs to the shared directory. Access thinks it's successful, and it closes. No error messages whatsoever.

Why are all three reports generated when I do everything manually, but fails (with no error messages) when Autoexec tries to do the same thing? The frustrating part is that this ability to do it on autopilot has been working flawlessly for over a year. Now all of a sudden it's doing this odd behavior.





--------------------
Greg Serrano
Michigan Dept. of Environment, Great Lakes, and Energy
Air Quality Division
Go to the top of the page
 
Start new topic
Replies
AlbertKallal
post Nov 1 2019, 11:32 AM
Post#2


UtterAccess VIP
Posts: 2,932
Joined: 12-April 07
From: Edmonton, Alberta Canada


The approach I used in the past is this one:

http://www.kallal.ca/BatchJobs/Index.html


The above is kind of nice, since then you not limited to running a particular macro on startup. The batch file (actually a windows script) thus allows you to call all of the routines.

One of the possible issues is that perhaps the report or routine is not 100% finished, and the you issue a quit application. I can't say this really has anything to do with your actual problem, since you had success doing what you doing for some time.

Anyway, take a quick read of that article - it might be worth a try. I would also note that my article is quite old, and you find these days if you just click on a windows VBS script it tends to launch as x64, and thus the whole easy part of that article tends to break down (you have to use cscript.exe to launch the script, and you have to make sure you choose the x32 bit of cscript.exe for the above ideas and article to work.

But, the article is simple in concept.
Regards,

Albert D. Kallal (Access MVP 2003-2017)
Edmonton, Alberta Canada

Go to the top of the page
 
FrankRuperto
post Nov 1 2019, 03:54 PM
Post#3



Posts: 520
Joined: 21-September 14
From: (MilitaryBrat) Tampa Bay, Florida, USA


@Albert

That's a good alternative, unless Greg's IT department has disabled running vb scripts in group policy settings.
What's curious is everything was working until about 3 weeks ago and no mods were made by Greg, so did a Windows, Office, or IT Dept update break it?
Could it be that you are linking to a password-protected backend and the password expired?
Have you run compact/repair on your FE?

The Access error message doesnt seem to relate at all to the problem.
Error 2001 usually occur when Access cannot make sense of part of an embedded SQL statement, or when elements within a Domain Aggregate Function are incorrectly specified.
Perhaps turning on trace and recording it in a log file could reveal, or looking at the Windows and Office Event logs?
You could spend hours trying troubleshoot the problem, only to find out there's nothing you can do about it with the existing setup, so a workaround like Albert's, if allowed, is a good solution.
This post has been edited by FrankRuperto: Nov 1 2019, 04:29 PM
Attached File(s)
Attached File  OfficeEvent.PNG ( 46.95K )Number of downloads: 2
Attached File  SystemEventLog.PNG ( 114.33K )Number of downloads: 3
 

--------------------
Currently supporting pawnbrokers that use my store management system developed with Access 2010 on Windows7. Experienced with Informix and Oracle DB's.
Go to the top of the page
 
FrankRuperto
post Nov 9 2019, 07:32 PM
Post#4



Posts: 520
Joined: 21-September 14
From: (MilitaryBrat) Tampa Bay, Florida, USA


@SerranoG

So it occurs to me that since your IT Dept restricts admin privs on your box that they're also auto logging you out of the box, or locking the account which requires a password to unlock, after X amount of inactive time?

If that's true, the task scheduler cannot launch your Access app if no user is logged in.

--------------------
Currently supporting pawnbrokers that use my store management system developed with Access 2010 on Windows7. Experienced with Informix and Oracle DB's.
Go to the top of the page
 

Posts in this topic
- SerranoG   Autoexec V. Manual Code Execution   Oct 14 2019, 01:54 PM
- - theDBguy   Hi Greg. Sadly, when something used to work but su...   Oct 14 2019, 01:57 PM
|- - cheekybuddha   Just thinking out loud, might the scheduled task r...   Oct 15 2019, 03:59 AM
|- - jleach   Running Access databases via the scheduler has alw...   Oct 15 2019, 08:01 PM
|- - SerranoG   Our IT dept. is notorious for pushing out Windows ...   Oct 22 2019, 03:05 PM
|- - dmhzx   Personally I would never use autoexc to do that. ...   Oct 22 2019, 06:17 PM
|- - SerranoG   QUOTE I would set up a macro with the runcode, giv...   Oct 24 2019, 06:47 AM
|- - cheekybuddha   Greg, it's an Access command line switch here....   Oct 24 2019, 07:13 AM
|- - dmhzx   As Cheeky Buddha says, the /X is an access command...   Oct 24 2019, 11:08 AM
|- - SerranoG   I did everything Cheeky and you suggested. I ran ...   Oct 25 2019, 08:24 AM
|- - cheekybuddha   Might any of the issues described here apply to yo...   Oct 25 2019, 08:28 AM
|- - cheekybuddha   Also, perhaps see if this situation is similar   Oct 25 2019, 08:31 AM
- - FrankRuperto   Is the database located in a trusted location? Som...   Oct 25 2019, 08:59 AM
|- - dmhzx   When you say it works if you run it manually, we a...   Oct 25 2019, 09:33 AM
|- - SerranoG   Cheeky & Frank, Yes, my Trust Center is set t...   Oct 25 2019, 09:34 AM
|- - FrankRuperto   Then perhaps it might be that Microsoft made some ...   Oct 25 2019, 09:48 AM
|- - cheekybuddha   Frank's suggestion about a default form may be...   Oct 25 2019, 09:48 AM
|- - SerranoG   I don't have admin rights on my work computer....   Nov 1 2019, 08:32 AM
|- - cheekybuddha   Hi Greg, Have you tried finding any reference to ...   Nov 1 2019, 09:34 AM
- - AlbertKallal   The approach I used in the past is this one: http...   Nov 1 2019, 11:32 AM
- - FrankRuperto   @Albert That's a good alternative, unless Gre...   Nov 1 2019, 03:54 PM
- - FrankRuperto   @SerranoG So it occurs to me that since your IT D...   Nov 9 2019, 07:32 PM



Custom Search


RSSSearch   Top   Lo-Fi    21st January 2020 - 12:06 AM