AutoExec Macro not passing OpenArgs

D

Doreen

I have an AutoExec macro that uses RunCode to run the following code:

Public Function StartDB()
Dim CheckLink As Boolean
CheckLink = True
DoCmd.OpenForm "fStartUp", acNormal, , , , , CheckLink
DoCmd.Close acForm, "fStartUp"
End Function

When I run the AutoExec macro by running the macro manually it works
fine. However, when it runs at database start up the OpenArgs value
does not get passed to the fStartUp form. It shows a Null value. I ran
across one post in 1998 where the same thing was happening but I saw
no resolution.

Can anyone point me in the right direction?

Thanks,

Doreen
 
G

Guest

I am suprised it works at all. The OpenArgs property should be a String
value, not a Boolean value.
Try changing it to a text value.
 
D

Doreen

I am suprised it works at all. The OpenArgs property should be a String
value, not a Boolean value.
Try changing it to a text value.

I actually started using a string but realized it was cleaner with a
boolean. It doesn't work as a string value either. As I said if you
manually run the macro everything works fine either passing a string
or a boolean value.

According to Microsoft document OpenArgs is a variant variable. I've
always used boolean or strings or numeric values and have never had an
issue.

This is the first time however that I've passed an OpenArgs in a form
that is being opened with the AutoExec.
 
W

Wolfgang Kais

Hello Doreen.
I have an AutoExec macro that uses RunCode to run the following
code:

Public Function StartDB()
Dim CheckLink As Boolean
CheckLink = True
DoCmd.OpenForm "fStartUp", acNormal, , , , , CheckLink
DoCmd.Close acForm, "fStartUp"
End Function

When I run the AutoExec macro by running the macro manually it
works fine. However, when it runs at database start up the
OpenArgs value does not get passed to the fStartUp form.
It shows a Null value. I ran across one post in 1998 where the
same thing was happening but I saw no resolution.

Can anyone point me in the right direction?

Check the startup properties of the database (Tools menu), and
verify that no startup form is specified.
Verify that no other macro action executed before opens the form.
 
D

Doreen

Hello Doreen.
Check the startup properties of the database (Tools menu), and
verify that no startup form is specified.
Verify that no other macro action executed before opens the form.

--
Regards,
Wolfgang- Hide quoted text -

- Show quoted text -

Thank you soo much Wolfgang, that was it. I was changing the way I
started the application and forgot to remove the form from the startup
options so it was loading without the OpenArgs. Thanks again.
 

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