Error Onload

S

Steve

I have an Access application that launches overnight and basically takes
data several different sources and outputs a new combined tables.

My code is very easy and there is code present in only the Form_Open event
and I have startup options set to open my form:
Dim strsql as string
Dim db as database
Set db=currentdb

then repeat these next two lines in various forms about 20 times.
strsql="my sql code"
db.execute(strsql)

I am linked to roughly 35 tables and the sql statements pull, filter,
delete, append, and update tables so I end up with a few tables with my
desired information.

This all seems to work great except I seem to run into one issue
occassionally - I lauch this via task scheduler and I'll come in in the
morning and the program will be open with the following error:

"the Expression [OnLoad] "does not result in the name of a valid procedure
or macro."

If I close it out and do nothing but double click it a second time it runs
fine.

It takes a hour to process everything and I have run it manually 50 times
and never, ever encountered that error. It runs most nights with no issue,
but once a week it returns that error. Nothings changing in the program and
I can't seem to pinpoint the issue.

Anyone have any clues or tips?

thanks
 
S

Steve

Thanks for the reply.

I just double-checked and task scheduler is actually launching a batch file
(.bat). The entry in the batch file is then: d:\programs\auto_eng.mde

Douglas J Steele said:
What exactly do you have as the command line in the Task Scheduler?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Steve said:
I have an Access application that launches overnight and basically takes
data several different sources and outputs a new combined tables.

My code is very easy and there is code present in only the Form_Open event
and I have startup options set to open my form:
Dim strsql as string
Dim db as database
Set db=currentdb

then repeat these next two lines in various forms about 20 times.
strsql="my sql code"
db.execute(strsql)

I am linked to roughly 35 tables and the sql statements pull, filter,
delete, append, and update tables so I end up with a few tables with my
desired information.

This all seems to work great except I seem to run into one issue
occassionally - I lauch this via task scheduler and I'll come in in the
morning and the program will be open with the following error:

"the Expression [OnLoad] "does not result in the name of a valid procedure
or macro."

If I close it out and do nothing but double click it a second time it runs
fine.

It takes a hour to process everything and I have run it manually 50 times
and never, ever encountered that error. It runs most nights with no issue,
but once a week it returns that error. Nothings changing in the program and
I can't seem to pinpoint the issue.

Anyone have any clues or tips?

thanks
 
D

Douglas J. Steele

See whether changing the bat file to include the path to Access makes a
difference:

"C:\Program Files\Microsoft Office.11\OFFICE11\Msaccess.exe"
"d:\programs\auto_eng.mde"

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Steve said:
Thanks for the reply.

I just double-checked and task scheduler is actually launching a batch
file
(.bat). The entry in the batch file is then: d:\programs\auto_eng.mde

Douglas J Steele said:
What exactly do you have as the command line in the Task Scheduler?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Steve said:
I have an Access application that launches overnight and basically
takes
data several different sources and outputs a new combined tables.

My code is very easy and there is code present in only the Form_Open event
and I have startup options set to open my form:
Dim strsql as string
Dim db as database
Set db=currentdb

then repeat these next two lines in various forms about 20 times.
strsql="my sql code"
db.execute(strsql)

I am linked to roughly 35 tables and the sql statements pull, filter,
delete, append, and update tables so I end up with a few tables with my
desired information.

This all seems to work great except I seem to run into one issue
occassionally - I lauch this via task scheduler and I'll come in in the
morning and the program will be open with the following error:

"the Expression [OnLoad] "does not result in the name of a valid procedure
or macro."

If I close it out and do nothing but double click it a second time it runs
fine.

It takes a hour to process everything and I have run it manually 50 times
and never, ever encountered that error. It runs most nights with no issue,
but once a week it returns that error. Nothings changing in the program and
I can't seem to pinpoint the issue.

Anyone have any clues or tips?

thanks
 
S

Steve

Thanks, I will give it a try.


Douglas J. Steele said:
See whether changing the bat file to include the path to Access makes a
difference:

"C:\Program Files\Microsoft Office.11\OFFICE11\Msaccess.exe"
"d:\programs\auto_eng.mde"
 
S

Steve

Unfortunately, this didn't seem to have any effect. If I cancel the error
and simply right click and run the scheduled task again without taking any
other actions - it runs fine. I have also tried to schedule the task at
different time and day areas in case something else was conflicting, but
still get the same thing. Any other ideas?



Douglas J. Steele said:
See whether changing the bat file to include the path to Access makes a
difference:

"C:\Program Files\Microsoft Office.11\OFFICE11\Msaccess.exe"
"d:\programs\auto_eng.mde"
Steve said:
I just double-checked and task scheduler is actually launching a batch
file
(.bat). The entry in the batch file is then: d:\programs\auto_eng.mde

Douglas J Steele said:
What exactly do you have as the command line in the Task Scheduler?

I have an Access application that launches overnight and basically
takes
data several different sources and outputs a new combined tables.

My code is very easy and there is code present in only the Form_Open event
and I have startup options set to open my form:
Dim strsql as string
Dim db as database
Set db=currentdb

then repeat these next two lines in various forms about 20 times.
strsql="my sql code"
db.execute(strsql)

I am linked to roughly 35 tables and the sql statements pull, filter,
delete, append, and update tables so I end up with a few tables with my
desired information.

This all seems to work great except I seem to run into one issue
occassionally - I lauch this via task scheduler and I'll come in in the
morning and the program will be open with the following error:

"the Expression [OnLoad] "does not result in the name of a valid procedure
or macro."

If I close it out and do nothing but double click it a second time it runs
fine.

It takes a hour to process everything and I have run it manually 50 times
and never, ever encountered that error. It runs most nights with no issue,
but once a week it returns that error. Nothings changing in the program
and
I can't seem to pinpoint the issue.

Anyone have any clues or tips?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top