|
 |
access thread: MSAccess DoCmds not available
Message #1 by "Padgett Rowell" <padgett@i...> on Thu, 19 Jul 2001 13:56:37 +0800
|
|
Hello Access Group,
I sent this message to the access_vba group as well, but have received
no response. The Access group seems to be more active, so if you
subscribe to both and subsequently have received this message twice, I
apologize.
Onto the problem!
I have created an access (2000) addin that has two buttons, 'new report'
and 'new query'. Pressing the buttons calls the following code lines:
DoCmd.RunCommand acCmdNewObjectReport
And
DoCmd.RunCommand acCmdNewObjectQuery
Respectively.
The problem is, in some databases when you launch the addin and press
the buttons; you get a "Selection is not available at this time" error.
I believe this has something to do with either the menu or toolbar that
is being displayed.
Does anyone know how to force the action?
Or how to load the toolbar / menu that is needed?
Which toolbar / menubar needs to be visible?
Cheers,
Padgett
Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Thu, 19 Jul 2001 07:50:25 -0700
|
|
These lines work for me from a simple form, even if I close the Form View
toolbar & hide the db window (which I believe simulates the problem of the
commands being inaccessible from a menu or toolbar).
Can you say more about your project? If you show the db window at the point
where your users would be triggering these actions, can you take these
actions manually?
Two other stray thoughts--first, you really can't create a new report in an
.MDE file, so that error message would be valid if the target database is an
mde file. Second, there is a method of the Application object called
.CreateReport which starts up a new report for programmatic
manipulation--maybe that's of use?
Hope that's helpful...
Cheers,
-Roy
-----Original Message-----
From: Padgett Rowell [mailto:padgett@i...]
Sent: Wednesday, July 18, 2001 10:57 PM
To: Access
Subject: [access] MSAccess DoCmds not available
Hello Access Group,
I sent this message to the access_vba group as well, but have received
no response. The Access group seems to be more active, so if you
subscribe to both and subsequently have received this message twice, I
apologize.
Onto the problem!
I have created an access (2000) addin that has two buttons, 'new report'
and 'new query'. Pressing the buttons calls the following code lines:
DoCmd.RunCommand acCmdNewObjectReport
And
DoCmd.RunCommand acCmdNewObjectQuery
Respectively.
The problem is, in some databases when you launch the addin and press
the buttons; you get a "Selection is not available at this time" error.
I believe this has something to do with either the menu or toolbar that
is being displayed.
Does anyone know how to force the action?
Or how to load the toolbar / menu that is needed?
Which toolbar / menubar needs to be visible?
Cheers,
Padgett
Message #3 by "Kent Rhodes" <kentrhodes@h...> on Thu, 19 Jul 2001 09:54:17 -0700
|
|
Do you get the same results with docmd.openquery ... and docmd.openreport...
?
-----Original Message-----
From: Padgett Rowell [mailto:padgett@i...]
Sent: Wednesday, July 18, 2001 10:57 PM
To: Access
Subject: [access] MSAccess DoCmds not available
Hello Access Group,
I sent this message to the access_vba group as well, but have received
no response. The Access group seems to be more active, so if you
subscribe to both and subsequently have received this message twice, I
apologize.
Onto the problem!
I have created an access (2000) addin that has two buttons, 'new report'
and 'new query'. Pressing the buttons calls the following code lines:
DoCmd.RunCommand acCmdNewObjectReport
And
DoCmd.RunCommand acCmdNewObjectQuery
Respectively.
The problem is, in some databases when you launch the addin and press
the buttons; you get a "Selection is not available at this time" error.
I believe this has something to do with either the menu or toolbar that
is being displayed.
Does anyone know how to force the action?
Or how to load the toolbar / menu that is needed?
Which toolbar / menubar needs to be visible?
Cheers,
Padgett
Message #4 by "Richard Lobel" <richard@a...> on Fri, 20 Jul 2001 07:20:31 -0700
|
|
Don't use the docmd.runcommand. Instead use the docmd.openreport. That
way you are not relying on toolbars or menubars.
Richard Lobel
Message #5 by "Padgett Rowell" <padgett@i...> on Mon, 23 Jul 2001 19:13:36 +0800
|
|
I have had a bit of feedback and will try and answer all questions at
once.
* The access addin is an mde file.
I have modified the code to read:
Application.CurrentProject.Application.DoCmd.RunCommand
acCmdNewObjectReport
And
Application.CurrentProject.Application.DoCmd.RunCommand
acCmdNewObjectQuery
When the user presses the newReport or newQuery button.
* Application.CurrentProject.Fullname is returning the path & name of
the host database which is as expected. (Not the addin being executed)
* .CreateReport is not going to work, as I want the user to be able to
use the native access wizards for new report and new query.
* I Read an MS article outlining this problem, they suggest that the
database window must be visible. I have tried this with no avail.
* I get the same error no matter which button the user pushes.
* Something small, cute and furry is going to suffer if I don't find a
solution soon (jokes :))
Part of my code lists all of the current reports & queries in the host
database. I use the same method in the listing routine to set a
reference to the host database as I do in the newReport & newQuery
routines - so I am assuming that the new routine is trying to make the
new object in the host database and not the addin (which would have
explained the error).
Any help would be appreciated.
Cheers,
padgett
-----Original Message-----
From: Pardee, Roy E [mailto:roy.e.pardee@l...]
Sent: Thursday, 19 July 2001 10:50 PM
To: Access
Subject: [access] RE: MSAccess DoCmds not available
These lines work for me from a simple form, even if I close the Form
View
toolbar & hide the db window (which I believe simulates the problem of
the
commands being inaccessible from a menu or toolbar).
Can you say more about your project? If you show the db window at the
point
where your users would be triggering these actions, can you take these
actions manually?
Two other stray thoughts--first, you really can't create a new report in
an
.MDE file, so that error message would be valid if the target database
is an
mde file. Second, there is a method of the Application object called
.CreateReport which starts up a new report for programmatic
manipulation--maybe that's of use?
Hope that's helpful...
Cheers,
-Roy
-----Original Message-----
From: Padgett Rowell [mailto:padgett@i...]
Sent: Wednesday, July 18, 2001 10:57 PM
To: Access
Subject: [access] MSAccess DoCmds not available
Hello Access Group,
I sent this message to the access_vba group as well, but have received
no response. The Access group seems to be more active, so if you
subscribe to both and subsequently have received this message twice, I
apologize.
Onto the problem!
I have created an access (2000) addin that has two buttons, 'new report'
and 'new query'. Pressing the buttons calls the following code lines:
DoCmd.RunCommand acCmdNewObjectReport
And
DoCmd.RunCommand acCmdNewObjectQuery
Respectively.
The problem is, in some databases when you launch the addin and press
the buttons; you get a "Selection is not available at this time" error.
I believe this has something to do with either the menu or toolbar that
is being displayed.
Does anyone know how to force the action?
Or how to load the toolbar / menu that is needed?
Which toolbar / menubar needs to be visible?
Cheers,
Padgett
|
|
 |